Learning React Using Perceptual Learning Techniques
In this blog post, I will give an account of my first attempt at learning how to use perceptual learning principles for learning React, “a declarative, efficient, and flexible JavaScript library for building user interfaces.”
With REACT, we are dealing with a particular way of laying out code, or architecture, commonly referred to as “the React way,” and a set of concepts important to understanding React, such as states (i.e., state-full vs. stateless functions) and intermediate functional programming operations. There is probably more to be said here but this is what I understood of React as I began this experiment. I had no previous experience working with React when I began.
Perceptual learning is premised on the idea that our subconscious is between 500,000 to 200 million times more powerful than our conscious. What we can consciously register is minuscule when compared to all the work that our subconscious is doing to help us navigate the world. What if we could harness the power of the subconscious and put it on the task of learning something? This is what perceptual learning is all about.
Perceptual learning is “perceptual” because it uses our incredible powers of perception (outwardly, these are our senses) to access our subconscious. I used my vision to read code, and sound/hearing to listen to the code I was reading (using text-to-speech feature built into my computer).
[ I should have enlisted my tactile sense by using my left hand and finger to follow along with the code - next time. I did not use smell, taste, or proprioception, but will think of ways of enlisting these in future experiments.]
I set the task to expose myself to many good examples of React over a short period of time to see if I could achieve expertise in React in a matter of weeks, not months or years. The examples have to be good examples - and by good I mean well organized, readable code of increasing levels of complexity. Below is my account of week one on this task.
The first thing I did was, in retrospect, counterproductive, and my first instinct was to rely on old ways of learning. I watched a tutorial to get an orientation in React. I chose the React Fundamentals course on Pluralsight because they offer uninterrupted (by quizzes) videos that can be watched on high speeds. In hindsight, I should have jumped into reading code right away....
The hardest thing was finding good examples of code, of increasing levels of difficulty, to read. Here are some resources that I uncovered:
5 Practical Examples For Learning The React Framework - five tiny projects of increasing difficulty, with comments, explanations, and the ability to run the code and see the results.
From the React getting started documentation page, this Tutorial: Intro To React that takes you through the steps to build an interactive tic-tac-toe game.
React.rocks collects a number of cool React projects and I followed some of these links to take a look at the projects’ code.
I spent about two hours reading through React code (unfortunately, not long enough), and I like to work in blocks of 40 minutes with a 5-10 minute break in between sessions using this Pomodoro Clock that I built for FreeCodeCamp.
After this, I jumped into an Open Source Software (OSS) Project available to me as a learner at Learners Guild - a clone of Trello. This was my official project for the week, and we had three issues that we were working to fix, one of which entailed building out some React components. Me and my partner on the project spent a good amount of time orienting ourselves in the code (about four hours) and working our way up to the task.
I also had the opportunity to shadow a group working on another OSS project at the Guild, read the code they were working on and observed their process.
After a couple days or so of perceptual learning and orienting myself in the well-organized code base I would be working with, I was able to jump in and navigate our team through extracting our a search bar component, putting it into its own file, and injecting it into the two places where it needed to be used. But I did have the help of the team lead (a professional programer) in implementing the changes.
I would not say that I acquired competency in React (I’d say I acquired familiarity and was comfortable working in a React code base) because I did break the code pretty badly a couple of times and had to revert to a prior commit and start over. When I broke the code, I tried to fix it and what I tried seemed to make things worse - not being familiar with reading React error messages made it difficult for me to troubleshoot the problems.
All in all, I came away feeling that what I had done to learn React was not that much different from what i have been doing in the past, availing myself of tutorials. I feel that I did not push myself hard enough to learn in a different way, and next time I will try to get out of my own way more and give my subconscious the space to do its work.
I probably jumped into the OSS project too soon. I feel that I should have spent some time building a small React project, where I would have been able to break and fix things more easily. But the good news is that building a simple app would have been well within my ZPD (Zone of Proximal Development)...
I got the grasp of some basic concepts that are well used in React, such as state-full functions, components, and controlled components, but I also realized that I needed to know a little bit more about functional programing - so I did discover some holes in my knowledge that I can work to fill.
I also came away with some questions about what is the use of React - I mean, it’s a javascript library so there is nothing you can do with React that you cannot do with plain old javascript. I found that all the compartmentalization that comes with building things out with components in the React way created a number of problems - maybe more than necessary. That is, I wasn’t sure what kind of project would benefit from React.
So I did a Google search and found a good answer:
React is cool. Switching to React helped me do :
1. Get rid of any jquery-like library.
2. Get rid of my HTML/Handlebars files :)
3. Generate dynamic CSS classNames for my components allowed me to get rid of stylesheets naming conventions / strategies ( BEM, etc. )
4. With the help of Flux ( yahoo's implementation ) I got rid of writing two code-bases ( front-end / back-end ). Now I'm putting everything in one place, this is awesome! ( I did it with server-side rendering, so I didn't loose anything at all )
Source: https://news.ycombinator.com/item?id=10348117
I also found this blog post on Medium helpful: “React is cool, deal with it”