Chapter 1 Flashcards
What is react?
A javascript library for building user interfaces.
What are components?
React uses components to render UI. Eg. header, footer, sidebar, headline, article content.
React components are custom html that can be reused.
How to build a react project? What all libraries and preprocessors are required?
Libraries-
React and react-dom
Javascript preprocessor - Babel
How to create a react component?
Create a function with first letter capital.
Return JSX from it. (Similar to html) - a div maybe
In last line write -
ReactDOM.render(, document.querySelector(“#p1”));
In Html- write
<div> </div>
Or you can render entire page by giving page id as app. And render app, where app is a jsx variable with all elements inside it.
How are attributes passed to react component?
We can pass props to the component as argument of the function.
Props.name will hold name
Props.email will hold email.
Why React?
Ui state becomes difficult to handle with vannila Js
Focus on business logic not on preventing your app from exploding
Huge ecosystem. Active community, high performance.
What are alternatives to react?
Angular,
Vue js
Backbone, amber
Jquery - has technical details a user has to keep in mind to use jquery. However it must be avoided when used with react.
What are two types of application?
Single page application.
Multipage application.
One HTML page, content is rendered on it. You get one html page from the server and then after everything else is managed by the javascript with react. Entire page has components managed by js.
Multipage application - every url has different pages. React can be used here. But not everything is managed by react here.
In spa, react dom is called once, allows to use react routers
In mpa, react dom is called multiple times. (Widget dont know of each others existence.)
Outline of course
- Getting started
- The basics - react components and their communication
- Debugging
- Styling components
- Components deep dive
- Http requests - spa, ajax, asynchronous http
Routing - Forms and Validation
- Redux
- Authentication
- Testing
- Deployment
- Bonus - animation, next steps, next.js
Get most out of this course
Code along
Check source code at the end of each unit
Ask in Q&A, try answering
Practice, practice, practice