Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2020
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. const [a, setA] = useState(null)
  2.  
  3. const callback = () => {
  4. if(a) {
  5. alert(a) // null
  6. }
  7. }
  8.  
  9. alert(a) // 1
  10.  
  11. useEffect(() => {
  12. if(true) {
  13. setA(1)
  14. }
  15. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement