> A small and performant state management and routing library with unidirectional data flow.
npm install reduxless  

Looking for the API? Click here
Reduxless combines the roles of reducers and actions into one operation: the two key operations are actions and selectors. We lose the ability to perform time travelling on our state, but the advantages of simpler and faster code can outweigh that benefit.
To install the stable version:
```
npm install --save reduxless
To include it in a Preact project:
`js`
import reduxless from 'reduxless/preact'
And for a React based projects:
`js`
import reduxless from 'reduxless/react'
Alternatively if you are using a library other than React or Preact, for example, inferno, you can inject the module into Reduxless like so:
`js
import createReduxless from "reduxless";
const reduxless = createReduxless(require("inferno"));
`
`jsx
import { h, render } from 'preact';
import { createStore, Container, mapper } from 'reduxless/preact';
const store = createStore({ name: 'Bart Simpson' });
const Component = ({name, updateName}) => (
const MappedComponent = mapper(
{
// selectors
name: store => store.get('name')
},
{
// actions
updateName: (store, ownProps, newName) => store.set('name', newName)
}
)(Component);
render(
)
`
The Container component provides the store to all of it's nested children components via context. Its use is optional and you can pass the store down manually if you prefer, for example:
`jsx`
render(
)
The mapper function is a performance convenience helper. It uses the given selectors to determine whether the mapped component should be rendered by doing shallow ref comparisons. This means it is important to create new objects when updating the store; otherwise, your components won't be updated. The actions are automatically injected with the store and the mapped component's props.
event and also whether the popstate event from the browser history navigation will update the store.In the example above if we wanted the
name property synced, it would be as simple as:`js
import { createStore, enableHistory } from 'reduxless/preact';const store = createStore({ name: 'Bart Simpson' });
enableHistory(
this.store,
['name']
);
`Routing is as straightforward as:
`jsx
import { h } from "preact";
import { Match, Link } from "reduxless/preact";const store = createStore({ name: 'Bart Simpson' });
enableHistory(
this.store,
['name']
);
const app = () => (
Todos
Counters
);
`The documentation section below describes the API in more detail, including configuration details for using hash; how to validate the data from the URL; and controlling one-way or two-way binding between the store state and browser URL.
Documentation
- API
- [
createStore([initialState])](https://dhassaine.github.io/reduxless/store)
- for the react bindings.
- enableHistory() for the browser history sync functionality.
- for the navigational components.
- selectorMemoizer(selectors, projectionFunction)` for improving rendering performance by wrapping your selectors with a memoizer.The state is not one nested object but multiple objects. This means libraries like reselect won't work as expected. Redux is expected to be given a new object for each reducer. Libraries like ImmutableJS can help with making modifications to the state as efficient as possible, but ultimately recreating an object with many properties just to get a new reference is expensive. Another bottleneck with Redux is that every reducer has to run when an action is dispatched. See perfomance analysis for further details.
This project follows semantic versioning.
MIT