Chronstruct / primitives

MIT License
2 stars 0 forks source link

txt accepts `transform` function #79

Open kylpo opened 3 years ago

kylpo commented 3 years ago

Use case is that of

export default function Date({ dateString, format = "full" }: Props) {
  const date = parseISO(dateString)
  return (
    <txt
      tag="time"
      tag-dateTime={dateString}
    >
      {formatting(date, formats[format])}
    </txt>
  )
}

could become something like

    <txt
      tag="time"
      tag-dateTime={dateString}
      transform={formatting(formats[format])}
    >
      {dateString}
    </txt>