Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattstypa/sillystore
Silly React Store
https://github.com/mattstypa/sillystore
Last synced: 18 days ago
JSON representation
Silly React Store
- Host: GitHub
- URL: https://github.com/mattstypa/sillystore
- Owner: MattStypa
- License: mit
- Created: 2018-07-31T20:56:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-10T18:58:54.000Z (over 6 years ago)
- Last Synced: 2024-09-25T22:25:05.804Z (3 months ago)
- Language: JavaScript
- Size: 69.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SillyStore
This is just silly.
Seriously. Don't even look at this silly React store.
- No actions.
- No reducers.
- No mapping of props.Connected components have a new prop.
- `store`: global state object.```js
import { Store } from 'sillystore';const initialStore = {
count: 0,
};ReactDOM.render(
,
document.getElementById('root')
);
``````js
import { connect, setStore } from 'sillystore';class Count extends React.PureComponent {
increment = () => setStore({count: this.props.store.count + 1})render() {
return (
Count: {this.props.store.count}
increment
);
}
}export default connect(Count, ['count']);
```## `connect(component, storeKeys);`
- `component` - React component.
- `storeKeys` - Array of store keys the component uses.