🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-better-effect

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-better-effect

React better effect

0.1.0
latest
Source
npm
Version published
Weekly downloads
38
280%
Maintainers
1
Weekly downloads
 
Created
Source

react-better-effect

npm npm bundle size npm type definitions GitHub

This package provides latest values in useEffect and useLayoutEffect.

TL;DR

import { useEffect } from "react-better-effect";

export default function App() {
  const [text, setText] = React.useState("a");
  const [text2, setText2] = React.useState("b");
  
  useEffect(($) => {
    const interval = setInterval(() => {
      console.log("effect1", $.text, text2 );
    }, 1000);
    return () => clearInterval(interval);
  }, [text2], { text });

  return (
    <div>
      <input value={text} onChange={(e) => setText(e.target.value)} />
      <input value={text2} onChange={(e) => setText2(e.target.value)} />
    </div>
  );
}

Demo

Please check this codesandbox example.

Keywords

react

FAQs

Package last updated on 31 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts