React.js: My first 20 hours
I have listened to Josh Kaufman several times talk about first 20 hours to learn something new. So I have decided to try the concept for myself while learning React.js.
The first thing I did was to identify what are the main concepts in React. The most common ones I could find were.
- JSX
- Components
- Props
- States
The second thing was to identify good learning resources that would focus on learning these concepts.
I found 3 resources that I think are excellent according to my current knowledge of React which is none. Zero.
Getting Started with React
- Getting started with React by Tania Rascia -Primary resource
- React FreeCodeCamp -Secondary resource
- React crash course by Brad Traversy -Tertiary resource
Day 1: Setting up Dev environment and Hello world
I spent day one creating a hello world create-react-app using my own index.js and app.js files. I also practised the Javascript import and export and understanding of how these two files talked to each other.
I was also able to create components in separate files and add the separate components to the main App.js file.
Day 2: Simple Components and Props
I spent 2 hours on simple components and props. I also spent an additional 15 minutes tackling challenges in Freecodecamp.
I made some notes while learning. Some of the things I learn are:
- Simple components are React component made using a function instead of a class.
- Props are properties. React uses props and states to handle data.
Day 3: State & review of props and components
Today, the plan was to tackle state in React. I was not feeling very confident in the props part of React so I reviewed my notes a little bit and then proceeded to the State section of Tania Rascia’s React tutorial I mentioned earlier.
I managed to go through the state section of the tutorial. However, at the end of that section, my code was not doing what it was supposed to be doing.
Once I clicked on the button, I got this error which I tried to solve to no avail.
I decided to pick the Freecodecamp curriculum(my secondary resource) where I left yesterday and solve some of the challenges. This way I can build up my knowledge well enough to troubleshoot this challenge. And that is what I did.
I was able to tackle 9 challenges involving props and components. These are:
- Render a Class Component to the DOM
- Write a React Component from Scratch
- Pass Props to a Stateless Functional Component
- Pass an Array as Props
- Use Default Props
- Override Default Props
- Use PropTypes to Define the Props You Expect
- Access Props Using this.props
- Review Using Props with Stateless Functional Components
In total, I spent 2hours 30 minutes learning React today.