question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help with porting scalajs-react-bridge

See original GitHub issue

Not exactly an issue, but I am trying to get types right while porting scalajs-react-bridge. I have it basically ported and all tests are passing, but I am not sure about the types I have used and I am facing one issue where I can use your help/pointers.

I will like these components to behave similar to div (of type TagOf[_]). Specifically, I will like to use components such as TestComponent in tests passing it arbitrary TagMods (such as onClick, onDoubleClick etc). In other words, I will like to be able to instantiate component in the following way:

   val testComponent = TestComponent(key = "mykey")(onClick --> someCallback)

However, when I do that in my testsuite (as well as real components outside this project), the resulting type for such an expression is TagMod. It looks like there is no implicit conversion from TagMod (unlike TagOf) to VdomElement (which perhaps is intended). As as result, I can’t do val mounted = ReactTestUtils.renderIntoDocument(testComponent).

I also suspect that I am overdoing things with ComponentNoChild and may not actually need it. I am not actually particularly keen on prohibiting children for certain components, but more interested in not requiring an additional set of () for component instances that don’t wish to pass children.

Thanks for your help.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
ramnivascommented, Jul 24, 2017

FYI and thanks!

This new version supports ‘neo’ and utilizes your improvements here.

https://github.com/payalabs/scalajs-react-bridge

0reactions
japgollycommented, Jul 14, 2017

Awesome, enjoy!

On 14 July 2017 at 11:30, Ramnivas Laddad notifications@github.com wrote:

@japgolly https://github.com/japgolly This looks great. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/japgolly/scalajs-react/issues/385#issuecomment-315244885, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMYtzPxJlhV3VuIQj44aW8I702KBmbOks5sNsS_gaJpZM4N3tsZ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

japgolly/scalajs-react - Gitter
@virtualirfan I prefer bridging. With the port-to-Scala approach, keeping code in sync with the original project will be a tough task.
Read more >
payalabs/scalajs-react-bridge - GitHub
A simple way to make React components in the wild usable in scalajs-react apps. Write a case class for each component and start...
Read more >
Scalajs-react: Facebook's React on Scala.JS - Morioh
Lifts Facebook's React library into Scala.js and endeavours to make it as type-safe and Scala-friendly as possible. Provides (opt-in) support for pure ...
Read more >
Community - Scala.js
Scala.js has a very active and friendly community supporting newcomers as well as seasoned Scala.js developers. To solve your issues, please use the ......
Read more >
From first principles: Why I bet on Scala.js
You didn't just get IDE support for writing Scala code interacting ... The first library that that was ported to Scala.js was the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found