ReactHooks.dev

useHooks()

useTSDX

2020-05-05 Anthony HumphreysUtility

Publishing hooks

One of the main outcomes I wanted from building this blog was to maintain a companion library of useful hooks. I’m writing most things in TypeScript these days (yeah I jumped on that hype train pretty hard, and haven’t looked back…)

Publishing a custom hook is as easy as publishing a component for react. That being said, I’d never published a library built with TypeScript so wasn’t entirely sure what was needed. That’s when I remembered Jared Palmer’s amazing TSDX CLI, I think I first heard about it on the SyntaxFM podcast.

I simply ran npx tsdx create hooks, dropped my code in the src directory, modified the github action included and hey presto, I’ve got a library live.

I’ll certainly be making more use of this tool, for libraries and React Components.

  • © Anthony Humphreys 2020