These are practical exercises for an introduction workshop to React and Redux. They are based on create-react-app.
- Simple React components (ES6 classes) that render HTML using JSX
- Instantiating components in JSX
- Event handlers that change component state (
setState
) - Declaring, passing and using component props
- Initializing state using props
- Passing callback functions as props
- Moving all state into the topmost component, making the other components stateless
- Creating a complex interactive UI in React with several components and central state
- Analyzing all application states and state transitions in preparation of Redux
- Managing the central state in a Redux store instead of React components
- Connected components, actions, action creators, reducers
- Rewrite the previous React examples using Redux
- Counter component with + and - buttons with a state:
count
- Same counter with a reset button
- Same counter with prop:
initialCount
- A counter without state, only props:
count
,onIncrease
,onDecrease
,onReset
. The state for all counters is saved in the parent component (App
). - Flickr search: Implement a complex UI in React
- Like Counter 4, but the state for all counters is managed by Redux.
- Flickr search with React and Redux
- Open the console
- Clone this repository with
git clone https://github.com/molily/learning-react.git
- On the console, run
cd learning-react
- Change into one of the subdirectories, e.g.
cd 1-counter1
- Run
yarn install
- Run
yarn start
- Open http://localhost:3000/ in the browser
In order to implement the exercises, we create a workspace with the React starter kit create-react-app
.
- On the console, run these commands:
yarn create react-app my-react-app
(my-react-app
is a folder name that you can choose freely) cd my-react-app
yarn start
- Open http://localhost:3000/ in the browser
The recommended approach is to start both the dev environment and the respective the reference implementation (different ports will be used automatically, like 3000 and 3001). Then you can start implementing your version. When you have questions, ask the workshop coach(es) or peak into the reference implementation.