japgolly / scalajs-react

Facebook's React on Scala.JS
https://japgolly.github.io/scalajs-react/
Apache License 2.0
1.64k stars 231 forks source link

Idiomatic example of using cats-effect? #1034

Closed peterstorm closed 2 years ago

peterstorm commented 2 years ago

Hello!

Thank you for creating this wonderful library!

I would just like to request an idiomatic example of how to use cats-effect in a simple example with hooks, if possible.

I've seen a few examples, though none of them wraps the component in IO or F[_] and neither anything in the render method, which ideally should also be a pure value?

I understand if it's not priority, but it would be awesome see an example in the docs!

japgolly commented 2 years ago

Here you go mate, I've added a live demo here: https://japgolly.github.io/scalajs-react/#examples/cats-effect

I hope that helps, and thank you for the kind words!

peterstorm commented 2 years ago

Thank you so much!