Code Monkey home page Code Monkey logo

Comments (15)

aindlq avatar aindlq commented on May 12, 2024

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.

PixelsCommander avatar PixelsCommander commented on May 12, 2024

@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.

aindlq avatar aindlq commented on May 12, 2024

@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.

PixelsCommander avatar PixelsCommander commented on May 12, 2024

JSX compiler... Sounds reasonable.

from reactive-elements.

kof avatar kof commented on May 12, 2024

@PixelsCommander .children is already used in my PR

from reactive-elements.

kof avatar kof commented on May 12, 2024

https://github.com/PixelsCommander/ReactiveElements/pull/43/files#diff-7321489e1afd632bdbdd2a6a1629cf6dR60

2 props, children and container ... both are absolutely required

from reactive-elements.

PixelsCommander avatar PixelsCommander commented on May 12, 2024

Got it. Give me a day to dive into your big pull request in details.

from reactive-elements.

kof avatar kof commented on May 12, 2024

children as a react elements seems to be a good idea

from reactive-elements.

kristianmandrup avatar kristianmandrup commented on May 12, 2024

What is the status on this? :)

from reactive-elements.

kof avatar kof commented on May 12, 2024

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.

PixelsCommander avatar PixelsCommander commented on May 12, 2024

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.

kof avatar kof commented on May 12, 2024

Why do you need a JSX transformer to create react elements?

from reactive-elements.

PixelsCommander avatar PixelsCommander commented on May 12, 2024

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.

kof avatar kof commented on May 12, 2024
  1. We could use "createNodesFromMarkup" and then create react elements. But yes it means traversing the tree of custom element children.
  2. 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.
  3. 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.

jackfranklin avatar jackfranklin commented on May 12, 2024

Closing this because it's very old, but please let me know if you would like this reopened :)

from reactive-elements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.