Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/malcolm-kee/redux-code-generator
- Owner: malcolm-kee
- Created: 2019-01-11T04:52:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:59:36.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T02:32:32.909Z (3 months ago)
- Topics: code-generator, redux
- Language: TypeScript
- Homepage: https://redux-code-generator.netlify.com/
- Size: 2.76 MB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
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