Skip to content

timdorr/react-log-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

React Log State npm package

A little tweak on @ryanflorence's React Lumberjack. Lets you track setState calls on React elements at runtime.

Setup

Install package:

npm install react-log-state

And include in your code:

require('react-log-state')

<script> tag

Add the following to your HTML anywhere:

<script src="https://npmcdn.com/react-log-state"></script>

Usage

Open up your browser's console. Select an element using the React DevTools (which makes it available on the $r variable). Then activate logging:

ReactLogState($r)

That's it! Any calls to setState will be logged in the console.


You can also hook into all setState calls globally:

ReactLogState.logAll()

Of course, this technically alters how setState operates, so you may have a bad time if any of your components making a lot of changes to state.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published