1.0.5 • Published 4 years ago

redux-store-codegen v1.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Code Generator for Redux

Prerequsites

npm install -g redux-store-codegen
npm install redux react-redux redux-thunk

Instructions

  1. cd into the directory you want to create the store in
  2. create store.schema.json file in the directory, each root level key represents a module, eg.
{
	"auth": {
		"user": {
			"value": {},
			"isAsync": true,
			"asyncVerb": "fetch"
		},
		"access_token": null,
		"refresh_token": null
	},
	"posts": {
		"posts": {
			"value": [],
			"isAsync": true,
			"asyncVerb": "fetch"
		}
	},
	"comments": {
		"comments": null,
		"likeCount": null
	}
}

Note: If isAsync flag is provided, _BEGIN, _SUCCESS, _FAIL action types will automatically be created along with relevant state flags

  1. run script, passing in schema as first parameter
create-redux-store ./store.schema.json
  1. /store directory will be auto generated, enjoy!

Note: import your newly created store from /store/store.js in App.js component and wrap with provider as per redux installation guide: https://react-redux.js.org/introduction/quick-start#provider

Generated Store Example

alt text

Action Types alt text

Action Creators alt text

Reducers alt text

Selectors alt text

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago