micro-observables
micro-observables copied to clipboard
using micro-observables library without react
I'm becoming quite fond of micro-observables and I'd like to use it in a library I'm writing that is not React based. I see 'react' is a peerDependency which will work fine but of course npm/yarn will complain of an unmet peerDependency.
The only react requirement if the hooks within https://github.com/BeTomorrow/micro-observables/blob/master/src/hooks.ts#L1, a thought would be to package this as a separate library just for the hook? or I believe making 'react' an optionalDependency might work as well.
Hi Peter,
Thanks for your feedback. You're right, micro-observables is not tightly coupled to React and it is probably a good idea to split it into two packages. The optionalDependency
option is unfortunately not a good solution for this, as it only specifies that if the dependency fails to install, npm install
will still succeed. It means that running npm install micro-observables
will actually install react in your project.
I'll probably split the library into two packages in the near future, I'll update this issue when this is done.