Packages needed in a React application
Packages needed in React Apps:
1. For Ajax calls:
axios
Command: npm install --save axios
2. For Routing:
react-router, react-router-dom
Command: npm install --save react-router react-router-dom
3. For managing state centrally:
redux
Commmand: npm install --save redux react-redux
4. For Redux Dev Tools:
install redux-devtool from Chrome Webstore
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
const logger = store => {
return next => {
return action => {
console.log('[Middleware] Dispatching', action);
const result = next(action);
console.log('[Middleware] next state', store.getState());
return result;
}
}
};
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(rootReducer, composeEnhancers(applyMiddleware(logger)));
4. Middleware for Redux (for making asyncrhonous calls):
thunk
npm install --save redux-thunk
5. Persistant Session
localStorage - built in to javascript
6. Testing Tools
Jest - which should be already installed
npm install --save enzyme react-test-renderer enzyme-adapter-react-16
1. For Ajax calls:
axios
Command: npm install --save axios
2. For Routing:
react-router, react-router-dom
Command: npm install --save react-router react-router-dom
3. For managing state centrally:
redux
Commmand: npm install --save redux react-redux
4. For Redux Dev Tools:
install redux-devtool from Chrome Webstore
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
const logger = store => {
return next => {
return action => {
console.log('[Middleware] Dispatching', action);
const result = next(action);
console.log('[Middleware] next state', store.getState());
return result;
}
}
};
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(rootReducer, composeEnhancers(applyMiddleware(logger)));
4. Middleware for Redux (for making asyncrhonous calls):
thunk
npm install --save redux-thunk
5. Persistant Session
localStorage - built in to javascript
6. Testing Tools
Jest - which should be already installed
npm install --save enzyme react-test-renderer enzyme-adapter-react-16
Comments
Post a Comment