πͺ What is React
Learning Objectives
React is a widely used JavaScript library for building user interfaces.
To write good React code, you must learn to think in React. Luckily for you, you have been learning JavaScript in a
Let’s start by exploring React Learn, the official docs for React.
𧩠Components
Learning Objectives
React Learn
React organises the code for a component into a single folder, and sometimes a single file. Everything that belongs to the component: styles, tests, etc, is in one place. This is a convention, not a requirement, but it’s a good one to follow.
Check your understanding
π’ Importing and Exporting
Learning Objectives
React Learn
π§ Think back to your Components workshop.
We exported functions to use in other files using modules. You can export your React components in the same way. A React component is a function, so you can export it like any other function.
Check your understanding
π¬ JSX syntactic sugar
Learning Objectives
React Learn
π§ Think back to your filterFilms project.
We used <template>
tags to store a plan of the HTML for our component. React uses a similar idea, but instead of <template>
tags, it uses JSX.
Check your understanding
π Embedding JavaScript
Learning Objectives
React Learn
There are many template languages. Some common ones are Handlebars, EJS, Jinja, Liquid, Go html/template and Twig. Once you understand one, the others are easier to pick up.
Check your understanding
π¦ Props
Learning Objectives
React Learn
π§ Think back to your filterFilms project.
We used
createCard()
function. React uses a similar idea.
Check your understanding
π¨πΌβπ¨ Rendering
Learning Objectives
React Learn
Here we return to control flow, that we learned about back in JS1. Search “conditionality” to remind yourself of the basics.
React Learn
Here is our friend the map()
function again! We can use it to render a list of items in React.
Check your understanding
π Keys
Learning Objectives
React Learn
β οΈ Keys
Check your understanding
Youtube: Codealong Playlist π
Prep Resilience
π€π½ FeedbackLearning Objectives
Introduction
10 Ways to Build and Develop Resilience
π― Goal: Learn some practical techniques (10 minutes)
Watch the video 10 Ways to Build and Develop Resilience.Protective Factors
π― Goal: Learn some practical techniques (30 minutes)
- Read Protective Factors.Β
- Estimate your place on the scales in the worksheet.
The Secret to Building Resilience
π― Goal: Learn an interesting perspective about your network of friends. (30 minutes)
- Read The Secret to Building Resilience.Β
- How many of these kinds of people are there in your network?