create-caspar-graphics
create-caspar-graphics copied to clipboard
Hooks API
Currently we read in each template and wrap it with our own Caspar component, which adds the data and state to its props, along with a new life cycle method (componentWillLeave
). It's a bit hacky and I think we can do a lot better with hooks.
I'm thinking we instead should export two hooks — useCasparData
and useCasparState
. We would need a new way to wait for the component to animate off before unmounting, but that shouldn't be too tricky.