switz/driver

Multiple nested states

switz opened this issue · 0 comments

switz commented

Very often we have multiple boolean flags to represent a component and a single finite state does not reflect the UI we want to build. How might we design a more flexible driver to handle nested finite states?

const card = driver({
  states: {
    USER: {
      ADMIN: isAdmin,
      MEMBER: isMember,
      LOGGEDOUT: true,
    },
    CARD: {
      IS_DELETED: card.status === 'deleted',
    }
  },
});

Jotting down some notes, need to think more here.