CLJS/JS interop re: nested JS

This past week I had a lot of bad time involving trying to use a 3rd-party Javascript API. The last problem I had took a lot of lost time before I realized that my #js call was NOT recursive, when the API needed a map like the following:

const login = async () => {
  await auth0Client.loginWithRedirect({
    authorizationParams: {
      redirect_uri: window.location.origin
    }
  });
};

My problem had come when I translated it as so:

#js {"authorizationParams" {"redirect_uri" (-> js/window .-location .-origin)}

Eventually, as is sometimes the case when writing in a transpiled language, I disregarded the cluelessly misleading log errors and realized I just needed to add a second #js to go with the second (nested) map. So, now my question: does anyone have recommendations when dealing with JS apis, particularly ones wanting nested data? I am looking at CLJS Bean from the esteemed Mike Fikes, https://github.com/mfikes/cljs-bean , but are there other recommendations or supporting comments?

oh, good gracious. This is built in with the clj->js function. clj->js

1 Like

You might be interested in j/lit and j/obj from GitHub - applied-science/js-interop: A JavaScript-interop library for ClojureScript.

2 Likes