Skip to content

I'd like to know how to use custom hook correctly #246

Closed Answered by whitehorse21
whitehorse21 asked this question in Q&A
Discussion options

You must be logged in to vote

Here is one sample
import { useEffect, useState } from 'react';

export function useIsMounted() {
const [mounted, setMounted] = useState(false);
useEffect(() => setMounted(true), []);
return mounted;
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@whitehorse21
Comment options

@whitehorse21
Comment options

Answer selected by whitehorse21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant