useMounted
True after the first client render. Use it to avoid server and client markup differences.
Source@monoline/react 0.5.0Markdown for AI toolsstable
- No DOM output.
Import
import '@monoline/css';
import {useMounted} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add use-mounted
Usage
import {useMounted, type Demo} from '@monoline/react';
function Demo() {
const mounted = useMounted();
return <p>{mounted ? 'Rendered in the browser.' : 'Server render.'}</p>;
}
<Demo />
Examples
Client only text
Behaviour
- No DOM output.