React Flashcards
What is React?
a JavaScript library for creating user interfaces.
What is a React element?
a plain object describing a component instance of DOM node and its desired properties.
How do you mount a React element to the DOM?
by using ReactDOM.render(element, container[,callback] )
What is Babel?
a JavaScript compiler, a toolchain that is mainly used to convert ECMA Script 2015 code into a backwards-compatible version of JavaScript in current and older browser environments.
What is a Plug-in?
a software component that adds a specific feature to an existing computer program.it enables customization
What is a Webpack loader?
loaders are transformations that are applied to the source code of a module
How can you make Babel and Webpack work together?
by using the babel loader. babel compiles js and webpack bundles js. babel loader bridges both of them together
What is JSX?
it is a syntax extension to JS that produces React “elements”. Although React doest require using JSX, most people find it helpful as a visual aid when working with UI inside the JS code.
Why must the React object be imported when authoring JSX in a module?
in order to to have Babel transform JSX into valid JS.
for React.createElement( )
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
with the babel-loader. Babel then has plugin that transforms react-jsx to valid JS back to webpack.
What is a React component?
components are like JS functions, they accept arbitrary inputs(called "props") and return React elements describing what should appear on the screen. can also be a JS class and has to return a react element
How do you define a function component in React?
functions have to be capitalized
How do you mount a component to the DOM?
with ReactDOM.render( ),
you must put the < /> (ankle brackets)
What are props in React?
stands for properties and is used for passing data from one component to another. Data with props are passed in a uni-directional flow(one way from parent to child). Props are objects
How do you pass props to a component?
by defining custom HTML attributes to which you assign your data with JSX.They are actually key value pairs