Help with porting scalajs-react-bridge
See original GitHub issueNot 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 TagMod
s (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:
- Created 6 years ago
- Comments:15 (15 by maintainers)
FYI and thanks!
This new version supports ‘neo’ and utilizes your improvements here.
https://github.com/payalabs/scalajs-react-bridge
Awesome, enjoy!
On 14 July 2017 at 11:30, Ramnivas Laddad notifications@github.com wrote: