Fork me on GitHub
#clojurescript
<
2023-05-18
>
oly13:05:48

Curios can you do hot reloading for files other than css so say .md or .org I am loading them into a web page but this does not trigger a reload when editing is this possible ?

oly07:05:34

Thanks, intresting not quite what I am after as my resources are loaded via ajax so I was kind of looking to rerun the ajax calls when the .md files change locally

zimablue13:05:31

it's definitely possible, I guess it depends on the tool you're using, but also if you're running an SPA you might not need to reload the page just fetch more content? like it could happen in an outer layer/your app?

Andrew Bowden16:05:16

Just trying to get something to show up on the screen. Has anyone worked with CanvasJS before in clojurescript?

p-himik16:05:19

Both the JS-CLJS and the React-Reagent interop is wrong.

p-himik16:05:59

To get a field, you should use .- instead of .. To use a React component in Reagent hiccup, you should precede it with :>, as in [:> CanvasJSChart ...].

Andrew Bowden16:05:32

That fixed those errors, but I'm now getting this:

p-himik16:05:07

You should definitely spend some time learning how to debug such errors. Most of the time, it's very simple, and being able to fix them yourself is unequivocally better than asking online. In this case, note that undefined in the first error. You're trying to use something as a React (Reagent) component that's undefined. Chances are, it's either CanvasJS or CanvasJSChart. Perhaps they should be accessed in some different way. Perhaps, CanvasJSReact should be imported in a different way.

p-himik16:05:50

Also, js/console.log is your best friend here. When you require some NPM package, you can log it and see whether the result does indeed look like something you'd expect and not, say, undefined or {default: ...} or {__esModule: ...} or something else.

Blake Bergstrom20:05:48

Did you try switching to node.js?

2
p-himik20:05:43

How is that relevant?

Andrew Bowden21:05:23

Import was incorrect, it worked after adding $default: ["@canvasjs/react-charts$default" :as CanvasJSReact]

👍 2