React Flashcards
What is React?
Framework to create interactive UIs in a web browser
What is a React element?
a plain object describing a component instance or DOM node and its desired properties., react component
How do you mount a React element to the DOM?
Render method
DOMElementHere.render(elementhere)
What is JSX?
a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file
Why must the React object be imported when authoring JSX in a module?
React elements will be undefined
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Babel reads the JSX and converts to JavaScript while webpack loads them module to read it.
plugin for babel loader
Using the appropriate converter with the proper babel loader
What is a React component?
JavaScript function that you can use markup with
reusuable code such as js functions
How do you define a function component in React?
Export default function functName() {
Return (
<div>
)
}
name is wit capitalized first letter and return JSX
</div>
How do you mount a component to the DOM?
Mount means render so that it displays, using render method
What are props in React?
standardized way to pass arguments to a function
How do you pass props to a component?
inside angle brackets, property = value
How do you write JavaScript expressions in JSX?
in curly brackets
What is the purpose of state in React?
re-renders the component to the browser
What is a React Effect?
Function that will execute after the render
When should you use an Effect and when should you not use an Effect?
Effects are typically used to “step out” of your React code and synchronize with some external system