Fork me on GitHub
#reagent
<
2022-10-04
>
jcb15:10:59

If I've imported a react component from npm, how can I access any associated functions in the same import? I'm currently getting a warning 'Cannot infer target type in expression' however the components and their refs are working as expected

p-himik15:10:35

Just mark that expression with ^js.

p-himik15:10:46

You can find a lot by that warning - both here and online.

jcb16:10:42

that stopped the warning but when I try to call the function, it throws an error stating that it isn't a function

p-himik16:10:29

Well, then the import is probably incorrect. If you're using shadow-cljs, there's a whole section in its documentation with examples and explanation on why some things work the way they do.

jcb16:10:48

thanks for the pointer, I'll take a look, it's just strange that the components render at all.

p-himik16:10:53

Probably that error is thrown at some point after the rendering is done. Or something catches that error and reports it instead of re-throwing it.