-
-
Save YaroslavRaksha/ce3d5875b925e4115cd12de2efeb507f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import customHook from "./customHook" | |
function App() { | |
customHook("ссылка") | |
const { state } = customHook(); | |
console.log(state) | |
return ( | |
<></> | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const customHook = url => { | |
const [state, setState] = useState(false) | |
fetch(url).then((data) => | |
/* допустим прилетает тру или фолс */ | |
if(data) { | |
setState(true); } | |
if(!data) { | |
setState(false); } | |
return { state } | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment