React Flashcards
What is React?
React makes it painless to create interactive UIs.
React will efficiently update and render just the right components when your data changes.
React is all about creating custom, reusable DOM elements and structuring the flow of data throughout the page, from actions taking place (example: user inputs text and pressed “return”) to the view being updated. It’s meant to provide a way to structure your interactions so that events that update the DOM flow through your components from highest in the DOM tree to lowest, updating the UI as changes happen that modify its state.
What is a React element?
React elements are plain objects that describes what the dom looks like
How do you mount a React element to the DOM?
through ReactDOM, Mounting” is when React “renders” the component for the first time and actually builds the initial DOM from those instructions.
ReactDom.render method
Symbols
are special markers, usually are property keys or property values.
Difference between library and framework
concept of inversion of control, Dom is a framework
Framework is a subset of a library that has inversion of control. give up control, it’s a framework
If you have control, it’s a library
What is Babel?
It’s to ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments
What is a Plug-in?
adds a specific feature to an existing computer program. When a program supports plug-ins, it enables customization
What is a Webpack loader?
Loaders are transformations that are applied to the source code of a module. pre-processing
Webpack by itself only knows javascript, so it needs additional help.
How can you make Babel and Webpack work together?
install the babel loader,
What is JSX?
JSX (JavaScript Syntax Extension and occasionally referred as JavaScript XML) is a React extension to the JavaScript language syntax[1]
which provides a way to structure component rendering using syntax familiar to many developers. It is similar in appearance to HTML.
Why must the React object be imported when authoring JSX in a module?
Becasue the React framework must be in scope from the JSX code in order to make calls to React.createElement
used in the final code that babel outputs
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
import the webpack and babel, with the react plugin, jsx transform plugin
What is a React component?
Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML. either a class or function
How do you define a function component in React?
declare a function that you would ordinarly do. then have a return, have a HTML tag, then the content you want inside it. function gotta be uppercased
How do you mount a component to the DOM?
call the render method of the ReactDOM object with two arguments, what you want to mount and where you to append it