const customHook = () => {
let [state, setState] = useState('пустой');
let arr = [1, 2, 3 ];
if(arr.length > 1) {
setState('полный');
console.log(state) /* пустой */
}
if(arr.length < 1) {
setState('пустой')
}
return {arr} /* пустой */
}
export default customHook;
const customHook = () => {
let [state, setState] = useState('пустой');
let arr = [1, 2, 3 ];
if(arr.length > 1) {
setState('полный', () => {
console.log(state)
});
}
if(arr.length < 1) {
setState('пустой')
}
return {arr} /* пустой */
}
export default customHook;