Coder Social home page Coder Social logo

Comments (12)

mindplay-dk avatar mindplay-dk commented on August 24, 2024 2

It's definitely low on my wishlist though - the critical thing (IMO) is sorting out the life-cycle events. Once that's done, I can actually start building my app with this ๐Ÿ˜„

from superfine.

jorgebucaran avatar jorgebucaran commented on August 24, 2024 1

You mean "the community" would prefer to rewrite my example as ๐Ÿ˜ฎ

const MyList = props =>
  </>
    <p>A</p>
    <p>B</p>
    <p>C</p>
  </>

?

from superfine.

mindplay-dk avatar mindplay-dk commented on August 24, 2024 1

?

Apparently, yeah ๐Ÿ˜†

from superfine.

jorgebucaran avatar jorgebucaran commented on August 24, 2024

@mindplay-dk Hmm, not really sure I'd want this at all, but why? What are the benefits; how does this help me make apps?

from superfine.

mindplay-dk avatar mindplay-dk commented on August 24, 2024

It enables you to implement functional components that return a range of elements - in other words, you're not longer forced to start every component with a (sometimes dummy) wrapper element.

Anyways, it's what JSX is now - it's already supported both by Babel and Typescript.

from superfine.

jorgebucaran avatar jorgebucaran commented on August 24, 2024

@mindplay-dk It enables you to implement functional components that return a range of elements - in other words, you're not longer forced to start every component with a (sometimes dummy) wrapper element.

We can create components that return a range of elements already!

const MyList = props => [<p>A</p>, <p>B</p>, <p>C</p>]

What we don't currently support is patching a root node that it itself is an array.

from superfine.

mindplay-dk avatar mindplay-dk commented on August 24, 2024

We can create components that return a range of elements already!

I know, but that's kind of ugly, and it's not how the JSX community wants to do it.

What we don't currently support is patching a root node that it itself is an array.

React also does not support that, as far as I know - the point of JSX fragments, if I understand correctly, is merely to be able to create a range of elements using XML-like JSX syntax, without having to wrap it in braces and brackets.

Anyhow, as said, this is definitely not a high priority for me, personally - but the community has decided they want this, and it's likely not much work to support it, especially if you factor your new implementation so it consistently operates on sets.

I'm much more interested in solving the ordering issues, for one :-)

from superfine.

Pyrolistical avatar Pyrolistical commented on August 24, 2024

the syntax is

const MyList = props =>
  <>
    <p>A</p>
    <p>B</p>
    <p>C</p>
  </>

and the main advantage is text nodes. people rather write <>hello<hr/></> over ['hello', <hr/>]

from superfine.

jorgebucaran avatar jorgebucaran commented on August 24, 2024

@Pyrolistical What does it compile to?

from superfine.

Pyrolistical avatar Pyrolistical commented on August 24, 2024

i don't understand your question, <>hello<hr/></> compiles to the same thing as ['hello', <hr/>]

from superfine.

jorgebucaran avatar jorgebucaran commented on August 24, 2024

Well, that answers the question. Thanks!

from superfine.

Pyrolistical avatar Pyrolistical commented on August 24, 2024

Apparently in order to support this you need to expose a function and set it to paramFrag

https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-react-jsx/README.md

from superfine.

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.