New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@infini-soft/hooks-draft

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@infini-soft/hooks-draft

Immutable Memento/Draft State React Hook. Using memento pattern, this tiny ~3k package adds up handy states to anything. You can change, undo, redo, draft, clear, commit, reset. Have status isDirty and if operation are available.

unpublished
latest
Source
npmnpm
Version
0.0.16
Version published
Maintainers
2
Created
Source

Getting started

Immutable Memento/Draft State React Hook. Using memento pattern, this tiny ~3k package adds up handy states to anything. You can change, undo, redo, draft, clear, commit, reset. Have status isDirty and if operation are available.

✨ Features

  • No dependency
  • Very small ~3K
  • Store any state
  • Undo
  • Redo
  • Commit
  • Clear
  • Reset
  • Typescript / Javascript

📚 Documentation

Get all documentations, examples and execute it directly from our website, the ☕ kitchen! Come cook software :) https://www.kitchen.infini-soft.com/hooks/draft

📦 Install

$ npm install @infini-soft/hooks-draft --save
# or
$ yarn add @infini-soft/hooks-draft

🔨 Usage

import React from 'react';
import { useDraft } from '@infini-soft/hooks-draft'

export default () => {
  const { data, draft, commit, clear, undo, redo, onChange, isDirty, reset } =
    useDraft('I love Infini-soft :)');

  return (
    <div className="root">
      <h1>Draft Example</h1>

      <div>Dirty = {String(isDirty)}</div>

      <div>Data = {data}</div>
      <div>Draft = {draft}</div>
    
      <input
        type="text"
        placeholder="change me..."
        onChange={(e) => onChange(e.target.value)}
        value={draft}
      />

      <button onClick={commit.run} disabled={commit.disabled}>
        Commit
      </button>

      <button onClick={clear.run} disabled={clear.disabled}>
        Clear
      </button>

      <button onClick={reset.run} disabled={reset.disabled}>
        Reset
      </button>

      <button onClick={undo.run} disabled={undo.disabled}>
        Undo
      </button>

      <button onClick={redo.run} disabled={redo.disabled}>
        Redo
      </button>
    </div>
  );
};

Powered 🚀 by Infinisoft Inc.
Wanna cook the future? Come in the kitchen [https://www.kitchen.infini-soft.com]

Keywords

infinisoft

FAQs

Package last updated on 17 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