You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
has props (props.something or ({something}) when accessing it)
importReactfrom'react';// function component - traditionalfunctionSomeComponent([props]){return(<></>)}exportdefaultSomeComponent;
importReactfrom'react';// function component - ES6 wayconstSomeComponent=([props])=>{return(<></>)}exportdefaultSomeComponent;
Class component
has state (this.state when accessing it)
has props (this.props when accessing it)
importReactfrom'react';// class componentclassSomeComponentextendsReact.Component{state={someKey: value};someMethodToManipulateState(){this.setState({someKey: newValue})}render(){console.log(this.[props])console.log(this.state)return(<></>)}}exportdefaultSomeComponent;
[props] is in brackets since component could but it doesn’t have to have them.