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

immery

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immery

Serialize and deserialize your GUI.

latest
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

immery

Serialize and deserialize your React GUI.

NPM

Install

npm install --save immery

Usage

import React, { Component, useState, useEffect } from 'react'
import Immery, {useProps, createEmptyData} from 'immery'

const Input = () => {
    const [ input, setInput ] = useProp('input')

    return (
        <div>
            input: {input}
            <div>
                <input type="text" value={input || ''} onChange={(event) => setInput(event.target.value)} />
            </div>
        </div>
    )
}

const App = () => {
    const [ data, setData ] = useState(() => createEmptyData())

    return (
        <Immery
            data={data}
            onChange={setData}
        >
            {({ undoable, redoable, undo, redo }) => {
                return (
                    <div>
                        <button
                            disabled={!undoable}
                            onClick={() => {
                                setData(undo())
                            }}
                        >
                            undo
                        </button>
                        <button
                            disabled={!redoable}
                            onClick={() => {
                                setData(redo())
                            }}
                        >
                            redo
                        </button>
                        <Input />
                    </div>
                )
            }}
        </Immery>
    )
}

License

MIT © tuoxiansp

FAQs

Package last updated on 21 Apr 2019

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