JSFiddle - React, Tailwind, and code Playground

by eget teteete

JavaScript

const initialState = 0;
  const reducer = (state = initialState, action) => {
    switch (action.type) {
      case "INC":
        return state + 1;
      default:
        return state;
    }
  };

  console.log(reducer(initialState, {type:"INC"}));