useInitialize()
ts
function useInitialize(callback): void;Defined in: init.ts:21
React hook of calling the callback only on the immediate component render, not on subsequent updates.
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | () => void | Callback to be executed on the immediate component render. |
Returns
void
Example
tsx
function MyComponent () {
useInitialize(() => {
console.log("This will only be logged on the early first render, not on subsequent updates.");
})
}Since
1.0.0
Author
Simon Kovtyk