Exercises!
React Week 08
Schedule
01
03
04
02
06
05
05
06
Review
Watch James Live code exercise 1
Exercise 2
Exercise 1
Show homework
Exercise 3
Break
Watch James Live code exercise 2
10 min
20 min
10 min
20 min
5 min
35 min
10 min
10 min
Previously on ReDI React
There are main ways to do Styling in React. What are they?
Inline styles in JSX
The syntax is a bit different in React than HTML.
Instead of passing a string with all of the styles to the attribute, we need to assign an object:
CSS Modules
The class defined in our CSS:
How we assign this class to an element:
Styled Components
Makes a react component
Call the component like you would any other HTML tag or React component
Styled Components
Also accepts props that affect the styling
Pass the props the same way you would any other React Component
Let’s make a clicking Game!
This is what we are going to make:
Tips before we begin
If you are struggling, try again after seeing the live coding.
Ask for help from your breakout room if you need it, we can all help each other :)
If you finish early, try the bonus tasks, ask teachers for feedback
Bonus Tasks
Exercise 1
https://codesandbox.io/s/week-8-exercise-1-z4qku?file=/src/App.js�� We need to a heading showing us the current score and a button to increase our score
Exercise 2
Work off your own game, or if you got stuck, you can start here:�https://codesandbox.io/s/week-8-exercise-2-xzg4m?file=/src/App.js
Break!
Exercise 3
Next steps:
Advanced
Homework ✏️
Make this game your own.