Intro Flashcards
When was react created? Who created it?
Created on 2011 by Facebook.
Why react?
Flexibility; Developer experience; Corporate investment; Community support; Performance; Testability;
Is react a framework? What are examples of frameworks?
React is a library. Angular and ember are frameworks.
Where react can be used?
Web apps, static sites, mobo apps through react native and desktop apps using electron.
“Learn once and use it everywhere”.
Can react be rendered only in the client side?
No… can be rendered in the server side by using next.js or gatsby or phenomic.
What are react renderers?
libs that renders react: react-dom, react-native and react-vr… there are many others..
Can react slowly replace existing web app components?
Yes… this is how facebook did to slowly replace all the components.
How react can be used to create components?
By simply receiving props and returning HTML or by creating a class that extends React.Component and then implement the method render(){
}
What is JSX? What does it stands for? What does it do?
JSX allows us to write HTML elements in JavaScript and place them in the DOM without any createElement() and/or appendChild() methods.
Stands for JavaScript XML.
JSX converts HTML tags into react elements.
What is the most popular way to create a react app?
By using create-react-app
How to start a react app?
By using npm start.
What happens when you make a mistake in the html syntax for example?
React shows a detailed message.
What does the debugger statement do in react?
It makes the browser stop in the breakpoint.
What is a codemod? What does it do? How many components does it cover by default on Facebook?
Used to upgrade react versions. Easily resolve breaking changes by running a script. 50k components are migrated using codemod.
Are there existing react components available out-of-the-box? Who are the three main publishers? Are there community-based react components? Where to find?
Yes. Fabric (MS), Material-UI (Google) and React Bootstrap (Twitter). Yes, find on enaqx/awesome-ract.
What is the concept of a Virtual DOM on react? Why does it exist? How does it work?
React minimizes DOM changes. Because updating the DOM is expensive. It is based on component states, only updates when the state updates.
What is the so called “layout thrash”? What is the effect of avoiding it by using React and its Virtual DOM?
When the browser has to recalculate the position of everything when a dom element changes. It saves performance and therefore battery and CPU.
What is the size of react and react dom? What are other react-like options that prioritizes the size?
35KB with gzip. Inferno (9kB) and preact (3kB).
How does React perform in the testability perspective?
It has an outstanding performance in testing: there is almost no need to ui tests, only unit tests… everything can be done in memory using nodejs.
What is the most popular unit testing framework for javascript?
JEST.
What is JEST snapshot?
Keeps the rendered components in memory so that it re-uses it.
React features against angular.
https://pasteboard.co/JdJHiqr.png
What is react?
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called “components”.