React_ReactTheCompleteGuide
installing sylted-components
% npm install --save styled-components
% npm init -y
% npm install redux
% node redux-demo.js
const redux = require('redux');
const counterReducer = (state = {counter: 0}, action) => {
if (action.type === 'increment') {
return {
counter: state.counter + 1
};
}
if (action.type === 'decrement') {
return {
counter: state.counter - 1
};
}
return state;
};
const store = redux.createStore(counterReducer);
console.log(store.getState());
const counterSubscriber = () => {
const latestState = store.getState();
console.log(latestState);
};
store.subscribe(counterSubscriber);
store.dispatch({type: 'increment'});
store.dispatch({type: 'decrement'});
Installing redux on react app
% npm install redux react-redux
% npm install @reduxjs/toolkit
or
% yarn add @reduxjs/toolkit
% npm install react-router-dom
% npx create-next-app
% yarn create next-app
react-transition-group package
npm install react-transition-group --save