1.1.3 • Published 1 year ago

rebaz-dev-global-state v1.1.3

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

rebaz-dev-global-state

Hare is globals state to management state

Installation

You can install rebaz-dev-global-state using npm or yarn:

<!-- note -->
    npm install rebaz-dev-global-state --save
    or
    yarn add rebaz-dev-global-state --save

Usage

import React from "react";
import { GlobalStateProvider } from "rebaz-dev-global-state";

function MyApp({ Component, pageProps }) {
  return (
    <GlobalStateProvider stateNames={[nameState]}>
      <Component {...pageProps} />
    </GlobalStateProvider>
  );
}
export default MyApp;

Usage Context

import React, { useContext, useEffect } from "react"

import { GlobalStateContext } from "rebaz-dev-global-state"

export default function App() {
  const { state, setData } = useContext(GlobalStateContext)

  const handleUpdateState = () => {
    setData(nameState,value)
  }

  const getState = () => {
    console.log(state?.nameState)
  }

  return (
    <>
      <div>APP</div>
    </>
  )
}

Note

    you must use React 18.2.0 or follow this steps change the package React version to (your version) by deleting node_modules from and replacing react from package.json then try `npm i` and `npm run build`  from rebaz-dev-global-state folder

github

License

MIT

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago