This project is just a coding part of what I learned from Thinking In React
Keep in mind Single responsibility principle which is a component should ideally only do one thing.
Break down the UI into components by using the UI mock and JSON data model.
Build the static version which is stateless and non-interactive.
First think of the minimal set of mutable state that your app needs.
Ask three questions about each piece of data:
- Is it passed from a parent via props? If so, it probably isn't state.
- Does it remain unchanged over time? If so, it probably isn't state.
- Can you compute it based on any other state or props in your component? If so, it isn't state.
Figure out which component mutates, or owns, the state.
- Identify every component that renders something based on that state.
- Find a common owner component (a single component above all the components that need the state in the hierarchy).
- Either the common owner or another component higher up in the hierarchy should own the state.
- If you can't find a component where it makes sense to own the state, create a new component solely for holding the state and add it somewhere in the hierarchy above the common owner component.
Need to bubble the changes to parents.
Create a callback from parent and pass to children to update the state when child components trigger changes.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!