This file contains hidden or 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
| function Root() { | |
| const [increment, setIncrement] = useState(0); | |
| useEffect(() => { | |
| const interval = setInterval(() => { | |
| setIncrement((inc) => inc + 1); | |
| }, 3000); | |
| return () => clearInterval(interval); | |
| }, []); |
This file contains hidden or 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
| // hooks/useUser.js | |
| export const getUser = async ({ id }) => { | |
| const { data, error } = await db | |
| .from('users') | |
| .select('*') | |
| .eq('id', id) | |
| .single(); | |
| if (error) { | |
| throw new Error(error.message) |
OlderNewer