HOW REACT WORK UNDER THE HOOD

Minhajabedin
Nov 10, 2020

JSX- jsx is an HTML like syntax that you can use with react to make it easier, to show something in UI JSX helps in react component, it is not mandatory to use JSX in react component but it helps us to easily create a large application.

Here is one example-

Const App =() =>{

Return <div> Hello world </div>

}

Default props- default props is the property in the react component. We can use it to set the default value of props.

For example-

Information.defaultProps={

Name: “minhazul”

};

// If props.name is not provided , it gonna be set by default to “minhaz”

render() {

return <Information/>

};

//props.name will be minhaz

proptypes — proptypes help us to define what types of props we are using, props can be different types of such as string and number. This helps us in future to find components easily and to understand what types of props are required.

For example-

const myItems = {

name: propTypes.string,

age: propTypes.number,

//define props validation

Const props = {

name :”hello” , // is valid

Age: “world”, // not valid

};

--

--

Minhajabedin
0 Followers

i am self thought front-end developer