create-caspar-graphics icon indicating copy to clipboard operation
create-caspar-graphics copied to clipboard

Hooks API

Open tobiasandersen opened this issue 4 years ago • 0 comments

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.

tobiasandersen avatar Apr 18 '20 13:04 tobiasandersen