Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/malcolm-kee/redux-code-generator

An application to generate redux code based on initial states
https://github.com/malcolm-kee/redux-code-generator

code-generator redux

Last synced: about 1 month ago
JSON representation

An application to generate redux code based on initial states

Awesome Lists containing this project

README

        

# Redux Code Generator

[![Coverage Status](https://coveralls.io/repos/github/malcolm-kee/redux-code-generator/badge.svg?branch=master)](https://coveralls.io/github/malcolm-kee/redux-code-generator?branch=master)

An application to generate redux code based on initial states.

[Site]


## The problem

You love redux where everything is simple and explicit, but you hates to write so many codes just to do a operation. Introducing abstration may reduce the code, but it is no longer simple and explicit.

## This solution

This is a web application that takes your reducer default state as input, and produces the following codes:

1. `action-keys` - the constants to shared between your actions and reducer
2. `actions` - all the action creators
3. `reducer` - the reducer
4. `selectors` - selectors to query data from your store
5. `unit tests` - Jest unit tests that test action creators, reducer, and selectors together

## Usage

1. Enter your initial state json into the "Initial State" text field. All the code will be generated!
1. If you would like to prefix your store/actions/reducer, use the "Store Prefix" field.
1. Select your application language (Javascript/Typescript). (Note: Typescript requires [typesafe-actions] package)

## Limitations

1. It is assumed that the initial state is a plain object (not array).
1. It is fine to have array in your state, but this application could not handle another array as descendent of array. (It is bad practice to have such redux store anyway).
1. Unit tests only support Jest

[site]: https://redux-code-generator.netlify.com/
[typesafe-actions]: https://www.npmjs.com/package/typesafe-actions