Comments (4)
That's very cool. If its working well, how are you trying to improve this?
My apologies if I took over that other issue and made it noisy so that the original intent was lost.
It is my belief that part of the interop issues have to do with how the Backend, Props and State are wrapped in scalajs-react. In the above, you are gluing constructor arguments directly into the actual object so you are essentially just using a js API with scala that looks like it is directly manipulating the js constructs using scala methods. This looks like it allows you to use the js react component in scalajs-react. However, depending on what components you define in scalajs-react, this may or may not allow you to get some of the features of component composition e.g. the values on property objects defined in scala typed property objects, in these components.
I'm just thinking through this myself to ensure that the expanding universe of js react components are available to us as seamlessly as possibly because there are alot of goods ones out there.
from scalajs-react.
The way you're doing it now is (generally) the best way that I can think of for now. It would be nice to reduce some of the verbosity. I was thinking the other day the scala.js pickling lib might offer something but I haven't really thought about it yet.
This highlights an important distinction. There's creating Scala components in React (which is what the library is primarily focussed on so far), and then there's wrapping JS components. JS component support is something I haven't given much attention to yet. By all means do suggest ways to improve this.
Composition of the two types should be fine with the exceptions of property and/or "backend" inheritance, and components just expecting other components to expose functions. I don't think either of those scenarios are desirable anyway. On the other hand if there's some awesome JS React component and it needs something like that.... Well, let's see how it goes. Please keep sharing problem scenarios and ideas.
from scalajs-react.
Gotcha, thanks so much.
from scalajs-react.
No worries. Good luck, dude!
from scalajs-react.
Related Issues (20)
- Export `assertOuterHTML` HOT 1
- Deprecate `Mounted` component types HOT 2
- Add default arg to `ReactTestUtils.withRendered` HOT 1
- ScalaFnComponent is anonymous HOT 2
- Consider using `DocumentFragments` in `ReactTestUtils` HOT 1
- Re-evaluate `ComponentDom` post- React 18
- Is there a way to integrate Components with cats.effect.Ref? HOT 1
- Ref not always set HOT 2
- Syntax to integrate `useContext` with context function in Scala 3 HOT 1
- Compilation fails in Scala 3 when deriving Reusability for case classes with multiple parameter groups HOT 1
- Missing getDerivedStateFromError
- Missing / misspelled packages in MODULES.md HOT 1
- Add support for Discussions tab in Github HOT 1
- Modern testing recipe?
- Cannot mix static and dynamic routes even if conditional
- A minimal setup fails with Scala 3 HOT 5
- Provide default IO/SyncIO error handler for component
- ScalaFnComponent doesn't include displayName HOT 1
- Another way to define hook components
- AsyncCallback + cats, gracefully handling errors with EitherT: unexpected behaviour HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalajs-react.