use-rendered
v0.1.2
Published
A substitute for useEffect which avoids multiple effects on load
Downloads
4
Readme
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>;
};