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

@lblanco/simple-store

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lblanco/simple-store

minimal store for react projects using context.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

@lblanco/simple-store

minimal store for react projects using context.

NPM JavaScript Style Guide

Install

npm install --save @lblanco/simple-store

Example

https://lucasblanco.github.io/simple-store/

Usage

import React from 'react'

import SimpleStoreProvider from '@lblanco/simple-store'

interface Store {
  name: string
}

const App = () => {
  const initialStore = {
    name: 'Lucas'
  }

  return (
    <SimpleStoreProvider initialValue={initialStore}>
      <Child />
    </SimpleStoreProvider>
  )
}
import React from 'react'

import { useSimpleStore } from '@lblanco/simple-store'

const Child = () => {
  const [store, updateStore] = useSimpleStore<Store>()

  const updateName = (name) => {
    updateStore((state) => {
      state.name = name
    })
  }

  return (
    <input
      type='text'
      value={store.name}
      onChange={(e) => updateName(e.target.value)}
    />
  )
}

License

MIT © LucasBlanco

FAQs

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