
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
> A small and performant state management and routing library with unidirectional data flow.
A small and performant state management and routing library with unidirectional data flow.
Looking for the API? Click here
Reduxless simplifies some of the complexity of Redux and reduces the amount of necessary boilerplate code. It is also much more performant and scales linearly as the application's state grows (see perfomance analysis).
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
Reduxless can be used with any React-like library.
To include it in a Preact project:
import reduxless from 'reduxless/preact'
And for a React based projects:
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:
import createReduxless from "reduxless";
const reduxless = createReduxless(require("inferno"));
The following snippet of code demonstrates how reduxless can be used with a React-like library -- in this case Preact:
import { h, render } from 'preact';
import { createStore, Container, mapper } from 'reduxless/preact';
const store = createStore({ name: 'Bart Simpson' });
const Component = ({name, updateName}) => (
<p onClick={
() => updateName(name == 'Bart Simpson' ? 'Lisa Simpson' : 'Bart Simpson')
}>
Hello there, {name}! Click to change me.
</p>
);
const MappedComponent = mapper(
{
// selectors
name: store => store.get('name')
},
{
// actions
updateName: (store, ownProps, newName) => store.set('name', newName)
}
)(Component);
render(
<Container store={store}>
<MappedComponent />
</Container>
)
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:
render(
<MappedComponent store={store}/>
)
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.
Reduxless offers a straightforward mechanism for both routing (i.e. which components to render based on the URL) and keeping the browser URL and store state in sync. You can choose which properties in the store will trigger a pushState 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:
import { createStore, enableHistory } from 'reduxless/preact';
const store = createStore({ name: 'Bart Simpson' });
enableHistory(
this.store,
['name']
);
Routing is as straightforward as:
import { h } from "preact";
import { Match, Link } from "reduxless/preact";
const store = createStore({ name: 'Bart Simpson' });
enableHistory(
this.store,
['name']
);
const app = () => (
<Container store={store}>
<ul>
<li>
<Link href="/todos">Todos</Link>
</li>
<li>
<Link href="/counter">Counters</Link>
</li>
</ul>
<Match path="/todos">
<Todos />
</Match>
<Match path="/counter">
<Counter />
</Match>
</Container>
);
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.
createStore([initialState])<Container>, mapper() for the react bindings.enableHistory() for the browser history sync functionality.<Match>, <Link> 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
FAQs
> A small and performant state management and routing library with unidirectional data flow.
We found that reduxless demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.