BeTomorrow / micro-observables

A simple Observable library that can be used for easy state management in React applications.
MIT License
104 stars 8 forks source link

using micro-observables library without react #7

Open pkieltyka opened 4 years ago

pkieltyka commented 4 years ago

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.

simontreny commented 4 years ago

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.