Conditional Rendering &
Rendering Lists &
Handling Events
React Week 04
Schedule
01
02
03
04
05
07
08
06
Recap
Conditional Rendering
Exercise
Break!
Rendering Lists
Handling events
Let’s code together !
Let’s code together !
15 min
10 min
15 min
15 min
15 min
15 min
15 min
15 min
Recap
Previously on ReDi React
Components and component types�State vs Props�Special Props ( key ,children ,ref )
Conditional Rendering
conditional rendering in React works the same way conditions work in JavaScript. Use JavaScript operators like if or the conditional operator to create elements representing the current state, and let React update the UI to match them
Let’s code the example together:�https://codesandbox.io/s/conditional-rendering-jxe4g
Exercise 01
Let’s create a real world example !
A navbar with login button VS logout button and a user greeting
https://codesandbox.io/s/conditional-rendering-exercises-wsp25
Questions?
Rendering Lists
Key prop
Break!
Examples
Let’s render the list and solve a bug together with Key
https://codesandbox.io/s/list-keys-81sei
Why do we need a key ?
https://codesandbox.io/s/rendering-lists-focus-demo-1gl51
Event Handling
Event Handling
Example
Let’s dive into event handlers together !
https://codesandbox.io/s/list-keys-81sei
Questions?
Exercise 02
Homework
Resources
https://reactjs.org/docs/conditional-rendering.html
https://reactjs.org/docs/lists-and-keys.html
https://reactjs.org/docs/handling-events.html
TBA
DOCS & WALKTHROUGHS
FURTHER READING / STRETCH