Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

React tool for debugging redundant re-renders

License

NotificationsYou must be signed in to change notification settings

multum/react-updates

Repository files navigation

Ease-to-useReact tool for debuggingredundant re-renders

Motivation

Trying to minimize the number of re-renders in our components usingPureComponent orReact.memo, developers spend a lot of time debugging redundant re-renders

react-updates is designed to simplify this process

Installation

npm i --save-dev react-updates# or using yarnyarn add --dev react-updates

OR using UMD build (exports a globalReactUpdates object)

<scriptsrc="https://cdn.jsdelivr.net/npm/react-updates/dist/react-updates.min.js"></script>

Getting started

// src/index.jsimport{setDebuggerSettings}from'react-updates';setDebuggerSettings({disabled:process.env.NODE_ENV==='production',});
import{useDebugger}from'react-updates';constView=React.memo((props)=>{useDebugger('View',props);return<divstyle={props.styles}>{props.content}</div>;});constApp=()=>{const[,setValue]=useState('');return(<div><inputonChange={(e)=>setValue(e.target.value)}/><View// < ❗ > causes re-renderingstyles={{width:'100%',display:'flex'}}content="Example use react-updates"/></div>);};

Using a class component

import{debugComponentUpdate}from'react-updates';classViewextendsPureComponent{componentDidUpdate(prevProps){debugComponentUpdate(View,prevProps,this.props);}// ...}

Contributing

Issue

Suggestions for introducing new features, bug reports, and any other suggestions can be written in the issue. They will be reviewed immediately.

Pull Request

Good pull requests, such as patches, improvements, and new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.

Pleaseask first if somebody else is already working on this or the core developers think your feature is in-scope forreact-updates. Generally always have a related issue with discussions for whatever you are including.

Please also provide atest plan, i.e. specify how you verified that your addition works.

License

react-updates is open source softwarelicensed as MIT.

About

React tool for debugging redundant re-renders

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp