1.0.4 • Published 6 years ago
redux-sands v1.0.4
Quick Intro
redux-sands
gives you a single class as default export, from now on called ReduxWrapper
. Here's a simple example that demonstrates how you could use it:
import ReduxWrapper from "redux-sands";
import component from "./component";
// Instantiate the wrapper.
const wrapper = new ReduxWrapper({ called: "example" });
// Simply add the initial state, the component for render + a reducer.
wrapper
.add({ initState: { count: 0 } })
.add({ component })
.add({ update: (state, action) => ({ ...state, ...action }) });
// Expose the redux-wrapper as any other redux-component.
export default wrapper.connection;
export const reducer = wrapper.reducer;
And now let's call it:
class Comp extends PureComponent {
render() {
// When using 'ReduxWrapper', only an object as param is allowed.
// Provide your values then via that object.
return (
<div onClick={() => this.props.update({ count: this.props.count + 1 })}>
Increment
</div>
);
}
}
As far as basic use cases go, that's it! No more hassle with manually creating actions, mappings and endless switches. Action-types get inferred automatically, as well as the linking to the reducer. You can focus on the actual app logic without having to deal with refactoring etc.
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
1.0.0-beta.9
6 years ago
1.0.0-beta.8
6 years ago
1.0.0-beta.7
6 years ago
1.0.0-beta.6
6 years ago
1.0.0-beta.5
6 years ago
1.0.0-beta.4
6 years ago
1.0.0-beta.2
6 years ago
1.0.0-beta.1
6 years ago
1.0.0-beta.3
6 years ago
1.0.0-rc2
6 years ago
1.0.0-rc1
6 years ago