Posts

Showing posts from June, 2024

week6.3 useState, usEffect, useMemo, useCallback, memo, useRef

 reconciliation  reconciliation is useState 1. import useState form react lib 2. write cosnt var which take two input (sate,  setState) satte mean if count 7 then state will be 7 then i press button and added 7+1 = 8 ; setSate tell state that you need to update yourself from 7 to 8; based on user entery. 3. the initial's it by 0 that help to store exact number to store eg: if i initial's it by 1 and the user update  state by 2 then state value need 2 but you got 3 thats wrong thats why .........! syntax:  import { useState } from 'react' //write this componenet inside the app OR another function const [count, setCount] = useState(0) then use this componenet and write you logic /============================================ useEffect: The useEffect Hook allows you to perform side effects in your components and stop unnecessary rendering, rerander when dependency change only. Some examples of side effects are: fetching data, directly updating the DOM, and timers. u...