Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

lucasmrdt/react-nedux

Repository files navigation

React-Nedux - The next react-redux

typescript version size

The official React bindings for nedux. Performant and flexible.

πŸ“¦ Installation

npm install react-nedux --save

πŸ’» Usage with examples

Name Source Codesandbox
βœ… Todo List here here
πŸŽ› Counter here here

πŸ“œ Documentation

Import

// ES6
import { createStoreHook } from 'react-nedux';
// ES5
var createStoreHook = require('react-nedux').createStoreHook;

createStoreHook(store)

Creates a Nedux hook with the same usage of useState.

argument required type description
store βœ… Store The store created by createStore.

useStore

The useStore hook created by createStoreHook can be used as same as useState.

πŸŽ› Basic Usage

Feel free to test it here.

import * as React from 'react';
import { render } from 'react-dom';
import { createStore } from 'nedux';
import { createStoreHook } from 'react-nedux';
const store = createStore({
 counter: 0,
});
const useStore = createStoreHook(store);
const increment = () => store.set('counter', prev => prev + 1);
const decrement = () => store.set('counter', prev => prev - 1);
const App = () => {
 const [counter] = useStore('counter');
 return (
 <span>
 <p>you've clicked {counter} times</p>
 <button onClick={increment}>+</button>
 <button onClick={decrement}>-</button>
 </span>
 );
};
const rootElement = document.getElementById('root');
render(<App />, rootElement);

πŸ™‹πŸΌ Contributions

All Pull Requests, Issues and Discussions are welcomed !

About

🧲 React provider of nedux - the next react-redux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /