React Library

Modern javascript front-end library for rendering HTML and building rich user interfaces.
Launched in 2013 and maintained by FaceBook. React is not a framework, it is just the View in an MVP architecture.
Focuses on reusable components which are very easy to maintain.
Uses a Virtual DOM that makes it extremely fast.
Gives you a lot of flexibility and is relatively easy to learn.
There are two main concepts: Properties and State.
JSX is a syntax extension to JavaScript (optional).
Both Outlook.com and Script Lab are written using React.

link - react.dev 
link - legacy.reactjs.org
link - reactenlightenment.com
link - react-typescript-cheatsheet.netlify.app

Components

Think of a component as a simple function
A JavaScript function takes input arguments and can return a value.
A React component takes properties and state and returns a user interface description
A component can have a private state that can change over time
Properties are called props.
If we want to override the constructor we have to pass 'props' to super


Functional vs Class

A component can either be a function component or a class component
React supports two types of components:
Functional - (or stateless) - used to isolate state management
Class
A functional (or stateless) component is a function which takes props as an argument and returns a React element.


props are immutable
state is mutable

currentTime : (new Date).toLocalTimeString(); 


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopNext