useMount
React lifecycle hook that executes a function after the component is mounted
Usage
Live Editor
function Demo() { const [value, setValue] = useState("UnMounted"); useMount(() => { setValue("Mounted"); }); return <div>{value}</div>; };
Result
Loading...
API
useMount
Returns
void
Arguments
Argument | Description | Type | DefaultValue |
---|---|---|---|
effect | effect function | () => void (Required) | - |