2.0.1 • Published 6 years ago
rsk v2.0.1
Redux Scaffold Kit
A CLI tool for scaffolding react and redux applications.
Installation
npm install -g rskNotes
Setting up the store
rsk setup-storeAdding a reducer
rsk reducer <reducer name> <...action names>Example:
rsk reducer volleyball add-score remove-scoreResults in:
store/volleyball/actions.js
export const ADD_SCORE = "ADD_SCORE";
export const REMOVE_SCORE = "REMOVE_SCORE";
export const addScore = () => {
  return {
    type: ADD_SCORE
  };
};
export const removeScore = () => {
  return {
    type: REMOVE_SCORE
  };
};store/volleyball/reducer.js
import { ADD_SCORE, REMOVE_SCORE } from "../actions/volleyball";
export default function volleyball(state = {}, action) {
  switch (action.type) {
    case ADD_SCORE:
      return state;
    case REMOVE_SCORE:
      return state;
    default:
      return state;
  }
}Connecting a component
rsk connect <component name> <...reducernames>Example:
rsk connect Sports volleyball soccerTurns this:
import React from "react";
const Sports = (props) => {
  return <div>Sports</div>;
};
export default Sports;Into this:
  import React from "react";
+ import { connect } from "react-redux";
  
  const Sports = (props) => {
    return <div>Sports</div>;
  };
+ const mapStateToProps = ({ volleyball, soccer }) => ({
+   volleyball,
+   soccer
+ });
- export default Sports;
+ export default connect(mapStateToProps)(Sports);Config
Redux Scaffold Kit can be configured using a .rsk.js file. Just add it to your root folder.
module.exports = {
  codeDirectory: 'src',
  storeDirectory: 'store',
  combineActionsAndReducers: false,
}2.0.1
6 years ago
2.0.0
6 years ago
1.0.4
6 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago
0.1.0
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago