Page 1 of 1
Q24 It is mandatory to call a hook within the custom hook True False Q25 Observe the below code snippet function Main()
Posted: Fri May 20, 2022 9:59 am
by answerhappygod

- Q24 It Is Mandatory To Call A Hook Within The Custom Hook True False Q25 Observe The Below Code Snippet Function Main 1 (85.3 KiB) Viewed 23 times

- Q24 It Is Mandatory To Call A Hook Within The Custom Hook True False Q25 Observe The Below Code Snippet Function Main 2 (85.3 KiB) Viewed 23 times
Q24 It is mandatory to call a hook within the custom hook True False Q25 Observe the below code snippet function Main() { const [counter, setCounter] = useState(0); const memoizedChild = useMemo(0 => { return <Child></Child> }, []); const onClickHandle = () => { setCounter(counter + 1) } return ( <div> {/* <h3> Use Memo</h3> */} <h2>counter: {counter}</h2> <button onClick={onClickHandle}>Increment</button> <h3> Child Component Counter</h3> {memoizedChild} {/* <h3> Memo render</h3> {memoizedChild} */} </div> ); } let renderCount = 0; function Counter() { useEffect(( => { renderCount++; }); return <div>rendercount: {renderCount}</div>; } What will be the value of renderCount when the increment button is clicked 5 times a) 1 b) 0 c) 5 d) 6
Q24 It is mandatory to call a hook within the custom hook True False Q25 Observe the below code snippet function Main() { const [counter, setCounter] = useState(0); const memoizedChild = useMemo(0 => { return <Child></Child> }, []); const onClickHandle = () => { setCounter(counter + 1) } return ( <div> {/* <h3> Use Memo</h3> */} <h2>counter: {counter}</h2> <button onClick={onClickHandle}>Increment</button> <h3> Child Component Counter</h3> {memoizedChild} {/* <h3> Memo render</h3> {memoizedChild} */} </div> ); } let renderCount = 0; function Counter() { useEffect(( => { renderCount++; }); return <div>rendercount: {renderCount}</div>; } What will be the value of renderCount when the increment button is clicked 5 times a) 1 b) 0 c) 5 d) 6