ReactJs 21022020
ReactJs 21022020
INTRODUCTION
Agenda
1. What is ReactJs?
2. Why using ReactJs?
3. Who are using ReactJs?
4. ReactJs Concepts
5. ReactJs Lifecycle
6. ReacJs Installation
7. Sample Project
What is ReactJs?
ReactJs Concepts
• JSX:
Javascript XML syntax transform.
Allows us to write HTML in React.
Makes it easier to write and add HTML
in React.
• Component:
Like functions that return HTML
elements.
Independent.
Reusable.
Two types: Class and Functional
ReactJs Concepts
• Props:
Like function arguments
Send into components as attributes
• render()
Is required method in class component
Outputs HTML to the DOM
ReactJs Lifecycle
• static getDerivedStateFromProps(props, state)
Is called right before the render method
Return object to update state, null to update nothing
ReactJs Lifecycle
• shouldComponentUpdate(nextProps, nextState)
Whether continue with render() or not
Default true
• getSnapshotBeforeUpdate(prevProps, prevState)
Is invoked right before the most recently rendered output is committed to the
DOM
access to the props and state before the update
check what the values were before the update
ReactJs Lifecycle
• componentDidMount()
Is called after the component is rendered.
• componentWillUnmount()
Is called when the component is about to be removed from the DOM.
ReactJs Installation
create-react-app <project-name>
cd <project-name>
npm start
Sample Project
Thank You