Error when rendering JS interop component
See original GitHub issueHi
Im trying to create an interop for this Button component (https://atlaskit.atlassian.com/packages/core/button). I can create facades for other components successfully, but I have no clue why this one failed. I tried to debug for a few hours, but I can’t seem to find a solution.
Its just a very simple component, equivalent in JS
import Button from "@atlaskit/button"
<Button>Click Here</Button>
My scala js interop
object Button {
@JSImport("@atlaskit/button", JSImport.Default)
@js.native
object RawComponent extends js.Object
val component = JsComponent[Null, Children.Varargs, Null](RawComponent)
}
got an error
Uncaught TypeError: Cannot read property 'ctor__Ljapgolly_scalajs_react_CtorType' of null
I’ve created a small project to replicate the problem here (https://github.com/allantl/scala-js-interop)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
asp.net core - JavaScript interop Error when calling javascript ...
JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendererd. When prerendering is ...
Read more >JSException in WebAssemblyRenderer · Issue #21874 - GitHub
That typically means the error is being thrown while processing the view code, or when you've modified the DOM with JS and it...
Read more >JavaScript Errors - Telerik UI for Blazor
Sometimes, the JS Interop file is referenced correctly and returns successfully, but occasionally you get the error. This indicates a timing issue (for...
Read more >Using JSInterop to Pass HTML Elements and Handle JS Errors
In this article, we are going to learn about using JsInterop to pass HTML elements to the JS functions and how to handle...
Read more >Prerender and integrate ASP.NET Core Razor components
Razor components can be integrated into Razor Pages and MVC apps. When the page or view is rendered, components can be prerendered at...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s great to know, thanks for sharing. This will be resolved in the next release.
Speaking of which, I meant to have the next release down by now but life popped up and I was preparing for a talk which I gave at an FP conference just this week (yay). I should have some more free time again now so I’ll be focusing on scalajs-react again as my main priority. Soon…
And thanks for the feedback, I’m very happy to hear that you’re enjoying the library. Cheers
@japgolly FYI, I’ve found out why the component doesn’t work. The library exposes the component in
React.forwardRef
.In JS,
will render successfully, even though no ref is passed.
I guess I’ll be waiting for this to be supported. Thanks for the good work so far!