Fork me on GitHub
#clojurescript
<
2022-12-26
>
hifumi12308:12:28

I am importing a React component bundled as a ES module. It has a single default export, which is the component itself. Is there a more elegant way to import the component than the following?

(:require ["some-component" :refer (default) :rename {default SomeComponoent}])

p-himik08:12:09

At least with shadow-cljs, you can use ["some-component$default" :as SomeComponent].

👍 1
hifumi12308:12:25

Perfect. I am indeed using shadow-cljs. Thanks!

👍 1
thheller09:12:27

regular CLJS feature too, not shadow-cljs specific

mesota09:12:25

How can you remove the ‘#’ symbol from a reitit router URL? I tried passing {:use-fragment false} into rfe/start! . That works when navigating using the links within the app but not when using the URL directly ( E.g, navigating from the address bar of a browser)

p-himik09:12:01

> E.g, navigating from the address bar of a browser If it's the initial loading of a web page (i.e. you open a new tab and enter the URL), then it's the server responsible for that routing and not the frontend. You can route all requests to /index.html and let reitit take it from there though.

thanks3 2
Naor Yaakov Harel12:12:20

Hey All, I try to implement phone number validation in my code. so the user will type his phone number and I will validate it before moving to the next step. I'm using #shadow-cljs and I tried to use the phone-number library (https://github.com/randomseed-io/phone-number/ I follow the instruction, and add the dependency as required but found the message "The required namespace "phone-number.core" is not available" Did anyone try to use this library before? any solution?

thheller12:12:16

this is a clojure library. it does not support clojurescript.

Naor Yaakov Harel12:12:51

Thanks! Do you have any recommendations for libraries that support Cljs?

p-himik17:12:28

There's probably plethora of JS libraries that you can install via NPM and use via JS interop from CLJS.

Naor Yaakov Harel13:12:50

Hey All. I try to use this library: [cljsjs/libphonenumber "8.10.18-0"] to implement phone number validation in my code. I add it to the #shadow-cljs file but it's not working. Did anyone use it? any idea? https://clojars.org/cljsjs/libphonenumber

thheller13:12:10

shadow-cljs does not support cljsjs packages. just use the npm package directly instead. npm install libphonenumber-js then (:require ["libphonenumber-js" :as x]) in your ns