Tips to build a Todo app with react, redux-saga, typescript and react-bootstrap — 2

Actions
  1. data update only action. For example, loadToDosError and loadToDosSuccess.
  2. command only action. For example, saveToDos.
Soldier folllows the order
soldier is wait for the order
Commander orders moveToVillage
clean saga
Test save
import * as redux from 'react-redux'

const spy = jest.spyOn(redux, 'useSelector')
spy.mockReturnValue({ username:'test' })
jest.mock('react-redux', () => ({
useSelector: jest.fn(),
useDispatch: () => mockDispatch
}));

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Canhua Li

Canhua Li

Senior Software Engineer — Microsoft