https://github.com/adbayb/baby-redux
📦 A small and lightweight Redux implementation
https://github.com/adbayb/baby-redux
library
Last synced: 3 months ago
JSON representation
📦 A small and lightweight Redux implementation
- Host: GitHub
- URL: https://github.com/adbayb/baby-redux
- Owner: adbayb
- License: mit
- Created: 2017-01-29T20:17:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T11:50:12.000Z (over 1 year ago)
- Last Synced: 2025-01-05T05:42:05.565Z (5 months ago)
- Topics: library
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# baby-redux
A small and lightweight Redux implementation
## API
Documentation credit goes to http://redux.js.org/
### createStore
```javascript
const store = createStore(reducer);
```Creates a Redux store that holds the complete state tree of your app.
### dispatch
```javascript
store.dispatch(action);
```Dispatches an action. This is the only way to trigger a state change.
### getState
```javascript
store.getState();
```Returns the current state tree of your application.
It is equal to the last value returned by the store's reducer.### subscribe
```javascript
store.subscribe(listener);
```Adds a change listener (callback function). It will be called any time an action is dispatched, and some part of the state tree may potentially have changed.
You may then call getState() to read the current state tree inside the callback.## License
[MIT](./LICENSE "License MIT")