natal-shell icon indicating copy to clipboard operation
natal-shell copied to clipboard

prefer defining react var instead of assuming it on global namespace

Open carocad opened this issue 8 years ago • 2 comments

Hey @dmotz, I saw that in the code you use js/ReactNative to get the current instance of ReactNative. However that way the user is forced to put ReactNative in the global scope, which shoudnt be a requirement IMHO. That is specially problematic if a user require the macros of this library before setting that up.

I think there are some libraries that define the js/ReactNative as global but I dont think is the case for all cljs libs out there. I would propose something like reagent approach. Basically if the object is already defined globally then rely on that, otherwise require it.

Let me know your thoughts :)

carocad avatar May 21 '17 20:05 carocad

Makes sense, will address in the next update.

dmotz avatar May 24 '17 01:05 dmotz

thanks 👍

carocad avatar May 24 '17 09:05 carocad