Khandagale-Saurabh / BeforeInterview

0 stars 0 forks source link

Reactjs #9

Open Khandagale-Saurabh opened 2 years ago

Khandagale-Saurabh commented 2 years ago

image

1] ComponentDidMount => UseEffect(()=>{ },[]} 2] ComponentDidUpdate => useEffect()=>[User] 3] WillUnmount ] => return inside useeffect

Datat from child to parent

image image

image

Redux : image

Khandagale-Saurabh commented 1 year ago

UseCallback

UseCallback is a React hook that lets you memoize a function. It can be used to optimize performance by caching the function so that it only needs to be created once.

Example:

const memoizedCallback = useCallback(() => { doSomething(a, b); }, [a, b]);

UseMemo

UseMemo is a React hook that lets you memoize a value. It can be used to optimize performance by caching the value so that it only needs to be calculated once.

Example:

const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);