FormidableLabs / next-urql

Convenience utilities for using urql with NextJS.
MIT License
56 stars 7 forks source link

Add instructions on using next-urql with ReasonML. #28

Closed parkerziegler closed 4 years ago

parkerziegler commented 4 years ago

Fix #12

This PR adds instructions on using next-urql with ReasonML. In my experience, maintaining separate bindings for libraries ends up being quite a time suck, especially as those libraries change over time. Moreover, I presume Reason users represent quite a small percentage of next-urql users. For that reason, I think some light documentation on writing a thin Reason binding that users maintain themselves is the best approach. This also means they only need to bind the parts of the library that they actually use. Particularly with something like Next's ctx object, a full type-safe binding of something like the IncomingRequest interface is beyond the scope of what we should support.

cc/ @dangdennis do you feel like this would give you enough to get started?

dangdennis commented 4 years ago

This is definitely enough. Thanks a lot for the write up! Funny enough, it was hard just finding a simple example of binding HOCs.

Yours help!

parkerziegler commented 4 years ago

Sweet, glad this could help! Yeah, it was a bit of a nightmare figuring out how this worked for a while, I wish there were some more formal documentation in ReasonReact on HoCs. They're still a relevant pattern in a lot of the React community, and trying to rework them into a render props style API doesn't always map cleanly 😕