# globix

> global state hook for react

Latest version **1.0.13** (published 2023-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install globix
pnpm add globix
yarn add globix
bun add globix
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.13 |
| Published | 2023-03-10 |
| First published | 2020-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | hyposlasher |
| Maintainers | hyposlasher |
| Keywords | react, global, global-state, global-state-hook, global-hook, state-management, hook, globix |

## Links

- npm: https://www.npmjs.com/package/globix
- Repository: https://github.com/hyposlasher/globix
- Issues: https://github.com/hyposlasher/globix/issues
- npm.io page: https://npm.io/package/globix

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.13.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.13 (latest) — 2023-03-10
- 1.0.12 — 2020-04-13
- 1.0.11 — 2020-04-13
- 1.0.10 — 2020-04-13
- 1.0.9 — 2020-04-13
- 1.0.8 — 2020-04-13
- 1.0.7 — 2020-04-13

## README

# React Global State Hook

Globix is the easiest way to bring global state to your React App

## Installing
```
npm i --save globix
```

## Usage

### Wrap your Root Component with `GlobixProvider` and pass optional `initialValues` props:
```javascript
import { GlobixProvider } from 'globix';

ReactDOM.render(
  <GlobixProvider initialState={{name: 'Daron Malakian'}}>
    <App />
  </GlobixProvider>,
  document.getElementById('root')
);
```

### Get global state anywhere in your application:
```javascript
import { useGlobix } from 'globix';

const SomeComponent = () => {
  const { globaslState } = useGlobix();

  return <p>{globalState.name}</p>;
}
```

### Set global state from anywhere you want:
```javascript
import { useGlobix } from 'globix';

const AnotherComponent = () => {
  const { globalState, setGlobalState } = useGlobix();

  const handleClick = () => {
    setGlobalState({
      ...globalState,
      newValue: 'new value'
    })
  }

  return <button onClick={handleClick}>change name</button>
}
```

## Authors

* **Dinislam Maushov** - *Initial work* - [hyposlasher](https://github.com/hyposlasher)

## License

This project is licensed under the MIT License

---
_Source: https://npm.io/package/globix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
