How to sync the view and the data
And the async calls comes...
We have only 16.6 ms to render the screen
const user = { name: 'Vitalii' };
function App(props) {
return <h2 className="green">Hello - {props.user.name}</h2>
}
<App user={user}/>
<h2 className="green">Hello - {props.user.name}</h2>
function a() {
return r.jsxs("h2", {
children: [' className="green" Hello - ', l, " "],
});
}
React (also known as React.js or ReactJS) is a free and open-source front-end JavaScript library for building user interfaces based on UI components. React can be used as a base in the development of single-page, mobile, or server-rendered applications with frameworks like Next.js. (C) Wiki
React - open-source, JavaScript library that transforms your data into the markup and track the changes
function App(props) {
return <h2 className="green">Hello - {props.userName}</h2>
}
document.querySelect('.green').innerText = 'Anna'
setState({userName: 'Anna'})
You write what you want to get, but not how you want to get
const form = document.createElement('form');
form.action = "/submit";
const header = document.createElement('h1');
header.innerText = 'Submit my email';
form.insertAdjacentElement('afterbegin', header);
...
Declarative approach is much more readable
All modern frameworks are based on components. But the most easy way to create a component - use React
@Component({
selector: 'my-component',
template: `<h1>Yes, I am a component</h1>`
})
export class MyComponent {}
const MyComponent = () => Yes, I am a component
You should not be afraid of creating as much components as needed