@chickendinosaur/inferno-storex
v3.0.8
Published
Inferno container creator for Storex store connections.
Downloads
38
Maintainers
Readme
Inferno container creator for Storex connections.
Specs
Performance
@chickendinosaur/inferno-storex
Overhead
@chickendinosaur/inferno-storex
Browserify (minified) \w with connect and Provider
34758 bytes
inferno-redux
Browserify (minified) \w with connect and Provider
53675 bytes
Getting Started
Installation
npm
npm install @chickendinosaur/inferno-storex
Usage
import { Store, Reducer } from '@chickendinosaur/storex';
import { connect, Provider } from '@chickendinosaur/inferno-storex';
// Store.
const store = new Store(new Reducer({
addCount: function (state, action) {
state.count += action.payload.incAmount
}
}), {
count: 5
});
// Test component.
function TestContainer (props, context) {
return (
<div>
{props.count}
</div>
);
}
// connect.
function mapStateToProps(props, state) {
props.count = state.count;
}
function mapDispatchToProps(props, dispatch) {
props.upAction = function () {
dispatch(new Action('addCount', {
incAmount: 1
}));
};
};
const TestContainer = connect(
TestComponent,
mapStateToProps,
mapDispatchToProps
);
// Top level render.
Inferno.render(
<Provider store={store}>
<TestContainer />
</Provider>,
document.getElementById('root')
);
Development
Installation
~/project/:
- npm install
Build
- npm run build
Benchmarking
- npm run benchmark
Test
- npm run test
Deploy
- npm run deploy
License
The MIT License (MIT)
Copyright (c) 2016 John Pittman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.