Scrimba Course FCC Flashcards
Why do we need to import React from “react”
React is what defines JSX
What is wrong with this code:
const page = (
<h1>Hello</h1>
<p>This is my website!</p>
)
We need our jsx nested under a single parent element
What does it mean for something to be “declarative” instead of “imperative”?
Declarative means I can tell the computer WHAT to do
and expect it to handle the details. Imperative means I need
to tell it HOW to do each step.
What does it mean for something to be “composable”?
We have small pieces that we can put together to make something
larger/greater than the individual pieces.
How to use Vite?
‘npm create vite@latest’
give project name
select framework
select varient
run commands
‘npm run dev’ to run
How to use map on an array
const arr = theArr.map(arrItem => do something)
What is state?
State is a way for react to remember saved values from within a component.
What do you get when you log React.useState()
?
You get an array of “[undefined, f()]”
How do you destruction the React.useState() array?
const [someName, setSomeName] = React.useState(“the name”);
console.log(someName), result: the name