SearchReducer.js 388 B

1234567891011121314
  1. export const SearchReducer = (state={}, { type, value }) => {
  2. if (type === 'SEARCH_RESULT'){
  3. return {
  4. searchResult: {...value}
  5. }
  6. }
  7. if (type === 'SEARCH_REMOVE'){
  8. return {}
  9. }
  10. return state
  11. }
  12. export const actionSearchResult = value => ({type: 'SEARCH_RESULT', value})
  13. export const actionSearchRemove = () => ({type: 'SEARCH_REMOVE'})