Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hooks-global-state

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hooks-global-state - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

26

__tests__/01_basic_spec.js

@@ -21,15 +21,15 @@ /* eslint-env jest */

};
const { StateProvider, StateConsumer } = createGlobalState(initialState);
const Counter = () => (
<StateConsumer name="counter1">
{(value, update) => (
<div>
<span>{value}</span>
<button type="button" onClick={() => update(value + 1)}>+1</button>
</div>
)}
</StateConsumer>
);
const { stateItemHooks } = createGlobalState(initialState);
const useCounter1 = stateItemHooks.counter1;
const Counter = () => {
const [value, update] = useCounter1();
return (
<div>
<span>{value}</span>
<button type="button" onClick={() => update(value + 1)}>+1</button>
</div>
);
};
const App = () => (
<StateProvider>
<div>
<div className="first">

@@ -41,3 +41,3 @@ <Counter />

</div>
</StateProvider>
</div>
);

@@ -44,0 +44,0 @@ const wrapper = mount(<App />);

@@ -5,4 +5,8 @@ # Change Log

## [0.0.2] - 2018-10-30
### Changed
- Update README
## [0.0.1] - 2018-10-28
### Added
- Initial experimental release
{
"name": "react-hooks-global-state",
"description": "Simple global state for React by Hooks API",
"version": "0.0.1",
"version": "0.0.2",
"author": "Daishi Kato",

@@ -57,3 +57,3 @@ "repository": {

"react-dom": "^16.7.0-alpha.0",
"react-use": "^1.2.0",
"react-use": "^3.1.0",
"ts-loader": "^5.2.2",

@@ -60,0 +60,0 @@ "tslint": "^5.11.0",

@@ -44,6 +44,6 @@ react-hooks-global-state

const App = () => (
<StateProvider>
<div>
<Counter />
<Counter />
</StateProvider>
</div>
);

@@ -63,1 +63,6 @@ ```

and open <http://localhost:8080> in your web browser.
Blogs
-----
- [TypeScript-aware React hooks for global state](https://medium.com/@dai_shi/typescript-aware-react-hooks-for-global-state-b6e2dfc0e9a7)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc