0.0.1 • Published 1 year ago

create-react-state v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Create React State

Install

pnpm add create-react-state

Create a useState

You can create a "useState" outside React components

import { createState } from 'create-react-state'

export const useCount = createState(0)

Use in any React Component

import useCount in any component

import './App.css'
import { createState } from 'create-react-state'

export const useCount = createState(0)

export default function App() {
  const [count, setCount] = useCount()

  return (
    <button onClick={() => setCount((count) => count + 1)}>
      count is {count}
    </button>
  )
}
0.0.1

1 year ago

0.0.0

1 year ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago