Comments (15)
What do you think about approach in https://github.com/greenish/react-mount? What I like there is that it is possible to expose any react component as custom element, e.g. react-bootstrap/react-bootstrap#506 . Actually maybe it would make sense to join forces with react-mount :)
from reactive-elements.
@aindlq Got it. You mean renaming props._children to props.children which makes it React compatible out of the box. @kof What do you think on this one? Should we do that?
from reactive-elements.
@PixelsCommander not really. My understanding is that it is not possible to use props._children directly in the render method because it is DocumentFragment, but react expects ReactElemenet or unsafe html there. react-mount compiles custom tag content using jsx compiler, as result children property is real react object. Advantage of this approach is that it is possible to use almost any existing react component as custom element without any changes to the source code.
from reactive-elements.
JSX compiler... Sounds reasonable.
from reactive-elements.
@PixelsCommander .children is already used in my PR
from reactive-elements.
2 props, children and container ... both are absolutely required
from reactive-elements.
Got it. Give me a day to dive into your big pull request in details.
from reactive-elements.
children as a react elements seems to be a good idea
from reactive-elements.
What is the status on this? :)
from reactive-elements.
my PR has been merged, the next step is to make children react elements instead of dom elements to be fully compatible with react.
from reactive-elements.
But JSX transformer is deprecated. Are there other ways around to implement
that?
2015-09-29 13:17 GMT+02:00 Oleg Slobodskoi [email protected]:
my PR has been merged, the next step is to make children react elements
instead of dom elements to be fully compatible with react.—
Reply to this email directly or view it on GitHub
#23 (comment)
.
from reactive-elements.
Why do you need a JSX transformer to create react elements?
from reactive-elements.
How would you transform JSX otherwise?
Or you want to convert HTML elements to React elements by traversing the
whole tree? I can barely understand why would this make sense. To place
{this.children} in render function? But it looks like a pretty a lot of job
on traversal and convertion every time we create an element.
2015-09-29 13:28 GMT+02:00 Oleg Slobodskoi [email protected]:
Why do you need a JSX transformer to create react elements?
—
Reply to this email directly or view it on GitHub
#23 (comment)
.
from reactive-elements.
- We could use "createNodesFromMarkup" and then create react elements. But yes it means traversing the tree of custom element children.
- I also don't see lots of use cases for using custom element with predefined inner elements together with react. I see it as an edge case where it should not be a lot of elements inside.
- Well if user wants to misuse this possibility and creates an overhead through this, its not libs fault. The approach how user creates custom element is not specific to this project, also user has full control about children.
from reactive-elements.
Closing this because it's very old, but please let me know if you would like this reopened :)
from reactive-elements.
Related Issues (20)
- Move to the Thread GitHub HOT 12
- Support named slots
- Replace children prop with <slot> tag
- ShadowRoot disabled performance impact HOT 9
- Pass properties of custom element as Props in React component
- Update tooling - add Prettier, editorconfig.
- Releases not in sync with `npm`. HOT 5
- IE11 support? HOT 1
- Remove UMD build in `dist` HOT 4
- Don't populate `document.registerReact` HOT 2
- Allow for a global configuration
- Add CONTRIBUTING.md guide
- transcluding children HOT 1
- Setup Travis/CircleCI
- Upgrade to new custom elements spec
- is this library works on browser env? HOT 2
- Regex requires extra curly brace around json object HOT 3
- Create new demo HOT 5
- V1.0.0 release: alpha HOT 1
- document.registerElement is deprecated and will be removed in M73 HOT 8
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 reactive-elements.