helix

https://github.com/Lokeh/helix
witek 2020-11-19T21:19:07.179500Z

Hello. I need a hint, how to use a react context value in a deeply nested component. The documentation explains how to create a context with helix.core/provider but not how to use it in the child component. Thank you. https://cljdoc.org/d/lilactown/helix/0.0.13/doc/creating-elements#context-providers

dominicm 2020-11-19T21:22:35.179900Z

https://reactjs.org/docs/hooks-reference.html#usecontext You're looking for useContext

ordnungswidrig 2020-11-20T09:39:11.184800Z

Why would one use react context rather than a dynamic binding in clojure?

wilkerlucio 2020-11-20T14:13:45.185900Z

useContext integrated on react, so if JS users use your component they can change it via standard react stuff. also the flow of both are different, dynamic binding loses its data if something async happens, while react contexts dont (to support react async rendering)

ordnungswidrig 2020-11-20T18:17:28.187Z

Oh, the point about async is interesting.

dominicm 2020-11-19T21:23:08.180100Z

And here's the helix wrapper @witek https://cljdoc.org/d/lilactown/helix/0.0.13/api/helix.hooks#use-context :)

👍 1