Git Product home page Git Product logo

reactime's Introduction

State Debugger for React

GitHub Build Status npm version Dependencies DevDependencies Vulnerabilities

demo

Reactime is a debugging tool for React developers. It records state whenever it is changed and allows the user to jump to any previously recorded state.

This tool is for React apps using stateful components and prop drilling, and has beta support for Context API, conditional state routing, Hooks (useState, useEffect) and functional components.

The latest release extends the core functionality by including support for TypeScript applications, improving the user experience through more declarative titles in the actions panel, and extending support for components with conditional state fields. The testing suite has also been expanded with the inclusion of a Sandbox utility to aid future expansion as well as additional E2E and integration tests with Puppeteer and React Testing Library.

After installing the Reactime, you can test its functionalities in the following demo repositories:

Reactime was nominated for the Productivity Booster award at React Open Source Awards 2020!

Installation

Two parts are required for this tool to function: a Chrome extension and an NPM package.

  1. Install the Reactime extension from Chrome Web Store. Alternatively, use src/extension/build/build.zip for manual installation in Developer mode. Turn on 'Allow access to file URLs' in extension details page if testing locally.

  2. Install the NPM package in your application's root directory.

npm i reactime
  1. Call the library method on your root container after rendering your App.
import reactime from 'reactime';

const rootContainer = document.getElementById('root');
ReactDOM.render(<App />, rootContainer);

reactime(rootContainer);
  1. For experimental concurrent mode support.
import reactime from 'reactime';

const rootContainer = ReactDOM.createRoot(document.getElementById('root'));
rootContainer.render(<App />);
reactime(rootContainer);
  1. Done! That's all you have to do to link your React project to our library.

How to Use

After installing both the Chrome extension and the NPM package, just open up your project in the browser.

Then open up your Chrome DevTools and navigate to the Reactime tab.

Features

Recording

Whenever state is changed (whenever setState or useState is called), this extension will create a snapshot of the current state tree and record it. Each snapshot will be displayed in Chrome DevTools under the Reactime panel.

Viewing

You can click on a snapshot to view your app's state. State can be visualized in a JSON or a tree. Also, snapshots can be diffed with the previous snapshot, which can be viewed under the Diff tab.

Jumping

Jumping is the most important feature of all. It allows you to jump to any previous recorded snapshots. Hitting the jump button on any snapshot will change the DOM by setting their state.

TypeScript Support

Reactime offers beta support for TypeScript applications using stateful class components and functional components with useState hooks. Further testing and development is required for custom hooks, Context API, and Concurrent Mode.

Additional Features

  • multiple tree graph branches depicting state changes
  • tree graph hover functionality to view state changes
  • ability to pan and zoom tree graph
  • multiple tabs support
  • a slider to move through snapshots quickly
  • a play button to move through snapshots automatically
  • a pause button, which stops recording each snapshot
  • a lock button to freeze the DOM in place. setState will lose all functionality while the extension is locked
  • a persist button to keep snapshots upon refresh (handy when changing code and debugging)
  • export/import the current snapshots in memory
  • declarative titles in the actions panel
  • extended support for components with conditional state fields
  • a Sandbox utility to aid future expansion

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

reactime's People

Contributors

rydang avatar joshua0308 avatar mylee1995 avatar nusanam avatar starkspark avatar yujinkay avatar andynullwong avatar dubalol avatar davidchai717 avatar chriswillsflannery avatar prasmalla avatar ergi516 avatar joshua-howard avatar rocky9413 avatar rkwn avatar rajeebbanstola avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.