1.0.1 • Published 5 years ago

use-assignment-state v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

useAssignmentState · NPM

React hook that give you the ability to have an state object that can perform changes with an assignment call.

I made this hook inspired in the new svelte 3.0 syntax, wich you can look here.

This was created for fun and, to be honest, I don`t really know if you should be using it, but that's your choice.

Install

npm install --save use-assignment-state

or

yarn add use-assignment-state

Usage

import React from 'react'
import useAssignmentState from 'use-assignment-state'

const Example = () => {
  const state = useAssignmentState({
    key: 'val',
  });

  return (
    <input
      value={state.key}
      onChange={(e) => { state.key = e.target.value; }}
    />
  );
};

More examples

You can check more examples here.

License

MIT © tcK1