componentwillreceiveprops hooks
SomeComponent (props) => {
useEffect( () => {
console.log('someProp updated');
}, [props.someProp])
return <div>Hi {props.someProp}</div>
}
componentwillreceiveprops hooks
SomeComponent (props) => {
useEffect( () => {
console.log('someProp updated');
}, [props.someProp])
return <div>Hi {props.someProp}</div>
}
componentwillreceiveprops hooks
const { useState, useEffect, useMemo } = React;
function App() {
const [count, setCount] = useState(50);
useEffect(() => {
setTimeout(() => {
setCount(150);
}, 2000);
}, []);
return <DisplayCount count={count} />;
}
function DisplayCount(props) {
const count = useMemo(() => props.count > 100 ? 100 : props.count, [props.count]);
return <div> {count} </div>;
}
ReactDOM.render(<App />, document.getElementById("root"));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us