How to use the react-context-hook.useSetAndDelete function in react-context-hook

To help you get started, we’ve selected a few react-context-hook examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Spyna / react-context-hook / example / src / UseSetAndDeleteExample.js View on Github external
export default function() {
  const [setValue, deleteValue] = useSetAndDelete('a-sample-key')
  return (
    <section>
      <h3>
        Set/Remove the key<code>'a-sample-key'</code> with the value{' '}
        <code>'the value'</code>
      </h3>
      <button> setValue('the value')}&gt;
        set 'a-sample-key' in store
      </button>
      <button> deleteValue()}&gt;
        remove 'a-sample-key' from store
      </button>
    </section>
  )
}

react-context-hook

A React.js global state manager with Hooks and Context API

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis