JSFiddle - React, Tailwind, and code Playground

by Gerald Gillespie

HTML

<h1>
hi
</h1>

TypeScript

const UserEventType = {
  CREATE: "create",
  COPY: "copy",
}

const context = { type: 'create', UserEventType};


const {  isCREATE, isCOPY } =  Object.entries(UserEventType).reduce((acc, [k, v]) => ({ ...acc, [`is${k}`]: v === acc.type }),{type});

console.log({ isCREATE, isCOPY })