Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-undo-redo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-undo-redo

A library to add undo-redo to any reducer

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76
increased by8.57%
Maintainers
1
Weekly downloads
 
Created
Source

react-undo-redo

A utility to add undo and redo functionality to any state managed through a reducer. This library does not require redux. If you're looking for something that adds undo and redo to a state that is managed through redux you might be in the wrong place.

Installation

Through yarn.

yarn add react-undo-redo

Through npm

npm install --save react-undo-redo

Usage

import React from "react";
import { createUndoRedo } from "react-undo-redo";

import { yourReducer } from "./yourReducer";

const { UndoRedoProvider, usePresent, useUndoRedo } = createUndoRedo(
  yourReducer,
  initialState
);

function Application() {
  return <UndoRedoProvider>{/* Your application code */}</UndoRedoProvider>;
}

function Menu() {
  const [undo, redo] = useUndoRedo();

  return (
    <>
      <button onClick={() => undo()}>Undo</button>
      <button onClick={() => redo()}>Redo</button>
    </>
  );
}

FAQs

Package last updated on 09 Oct 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc