Tags

Tags allow you to reference things in Cerebral. They are based on template literal tags. They can be used by operators, connect and compute. Some of them can also be used with other Cerebral modules. The great thing about tags is their composability. For example:

import {state, props} from 'cerebral/tags'

state`items.${state`currentItemKey`}`

state`items.${props`itemKey`}`

This allows you to express signals and component dependencies more effectively. There are 4 tags in Cerebral.

  • state - Used in signals and connect to target state
  • props - Used in signals to target payload and in connect to target component props
  • signal - Used in signals and connect to target a signal
  • string - Used in signals to evaluate a composed string