UseRendered
Use as a substitute for useEffect when waiting for first render. Run once, on mount.
Install
npm install use-rendered
Example code - compare useEffect with useRendered
import React, { useEffect } from 'react';
import { useRendered } from 'use-rendered';
export const SomeComponent = () => {
useEffect(() => {
console.log('useEffect: component rendered');
});
useRendered(() => {
console.log('useRendered: component rendered');
});
return <h1>useRendered()</h1>;
};