Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tjdavies/hyper-redux

hyper app style redux react
https://github.com/tjdavies/hyper-redux

Last synced: about 1 month ago
JSON representation

hyper app style redux react

Awesome Lists containing this project

README

        

## hyper-redux

HyperApp style redux

For those who need to use react and redux but want something simple

- No more switch statments or action objects
- Fully supports redux debugger with time travel ect.
- Can be strongly typed with TypeScript
- Can use context to access state and actions in nested components

## Install

```sh
npm install hyper-redux
```
## Example

```js
import * as React from 'react';
import { app } from 'hyper-redux';

const initalState: 0;

const actionsMap = {
increment: delta => state => state + delta,
decrement: delta => state => state - delta,
incrementDelayed: delta => (state, actions) => {
setTimeout(actions.increment, 1000, delta);
return state;
}
};

function view(state, actions ) {
return (


Clicked: {state} times


actions.increment(1)}>+
actions.decrement(1)}>-
actions.incrementDelayed(1)}>+ delayed

);
}

app(initalState, actionsMap, view, document.body);
```

## Live Demo

[![Edit hyper-redux example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/745pqpnoz6)