use
i.e useBlabla()
useState:
// parameter of useState will be default value of `count`
// setCount is a function taking 1 parameter to update the count
const [count, setCount] = useState(0);
useAffect:
useEffect(() => {
document.title = 'blah blah';
});
useEffect(() => {
document.title = 'blah blah';
return cleanup () {
// doing cleaing up here
}
});
useAffect
useEffect(() => {
document.title = 'this is going to be render again when only props.customerId is updated';
return cleanup () {
// cleaing up here will only be fired when props.customerId is changed
}
}, [props.customerId]);