React Hooks Basics
Utility Function
Ultility fuction is a normal fucntions it return some value.It denoted as helper fucntion.It is an resuable function we can use multiple times in our program.It placed in the Utlity directory.Also the extension for ulilityfunction is .js not .jsx bcz it return values not html elements.
Hooks
hook is an function that may or may not return someting.If it returns it may be muliple item.the multiple items can singel or mulitple variable and single or multiple function.All hook fuction is start with the word use eg:useState,useEffect,useMemo.We can also create custom hooks based on our need.
useState-useState is an predefined react hook which is use to create and manage state in reat.It acceps two values one is current state value/ intial value and another one is fucntion use to update the state.
Syntax: const [state,setState]=useState(intial value).
Get SANTHOSH KUMAR M’s stories in your inbox
Join Medium for free to get updates from this writer.
Ex:
Props
Props is used to pass some value from parent component to child componen wich is called as props.props is an object which is key value pair
Diff between state and props was state that stay within the component where props pass some value from parent component to child component.
EX:







