News for hackers. Stuff that matters.
Re:Exact – a new cross platform UI framework by the Expo team by whilenot-dev on Tuesday November 10, 2026 @02:13AM (#50437069)
If I understand you correctly, #1 is just plain wrong. JSX is transformed into standard ECMAScript. You can store JSX-nodes in variables and pass them around however you like.

  // this
  <Box>
    {
      shouldShowAnswer(user)
        ? <Answer value={false}>no</Answer>
        : <Box.Comment>
            Text Content
          </Box.Comment>
    }
  </Box>

  // ...can be written like this
  const answer = (
    <Answer value={false}>
      no
    </Answer>
  );
  const comment = (
    <Box.Comment>
      Text Content
    </Box.Comment>
  );
  const result = shouldShowAnswer(user) ? answer : comment;

  <Box>
    {result}
  </Box>
In React at least, null won't render anything.

#2 is a known trade-off, and so marginal and well known that it's almost not worth mentioning it.

Re:Exact – a new cross platform UI framework by the Expo team by halflife on Tuesday November 10, 2026 @05:19AM (#50438266)
It’s not wrong, this is a limitation of JSX, every interpolation needs to be a statement.

Ofcourse you can split every control flow into separate component and combine them together finally, but that means exactly that - that every minute condition or iteration is deferred elsewhere. And it makes the actual render result hard to understand.

Re:Exact – a new cross platform UI framework by the Expo team by whilenot-dev on Tuesday November 10, 2026 @06:36AM (#50438880)
At this point I honestly don't know what you're on about...

> every interpolation needs to be a statement

Interpolation??? JSX extends the PrimaryExpression in the ECMAScript grammar. So yeah, every JSX element/fragment is an expression, not a statement. You can't seriously consider an ECMAScript expression a limitation?

> you can split control flow into separate component[s]

You do realize that none of the variables in the example above are components, do you? They are the result of JSX elements, and if we're talking React they'd be React elements.

> combine them together [...] makes the actual render result hard to understand

So, for you, a long ECMAScript expression is a limiting factor, but composing shorter, simpler expressions into a longer, more complex one is hard to understand. Even though in your comment above you wrote:

> simple workflow controls would read much better

What's your alternative?

Re:Exact – a new cross platform UI framework by the Expo team by halflife on Tuesday November 10, 2026 @08:46AM (#50440278)
I may have mixed between expression and statement, however in JSX {} must return exactly 1 expression, so that limits the amount of code you can place there.

Your'e missing the point arguing about semantics of components or JSX elements, the point is that if you want to avoid control flow via expressions, you must destruct you template (however simple it may be) into tiny template fragments that makes it harder to understand the complete rendered picture.

Imaging if JSX could look like this:

  <div class="container">
    My list
    @for(item in list) {
      <h2>{item.name}</h2>
      @if(item.loading){
        <p>Loading...</p>
      } @else if (item.error) {
        <p>Error loading item</p> 
      } @else {
        <p>{item.description}</p>
      }
    }
   </div>
This is much easier than the suggested JSX approach:

  const renderItem = (item) => {
    if(item.loading){
      return <p>Loading...</p>
    } else if (item.error) {
     return <p>Error loading item</p>
    }
    return <p>{item.description}</p>
   }

  const renderList = (list) => {
    return list.map(item => {
     return <>
      <h2>{item.name}</h2>
      {renderItem(item)}
     </>
    })
   }
  
  return <div class="container">
    My list
    {renderList(list)}
   </div>
Re:Exact – a new cross platform UI framework by the Expo team by whilenot-dev on Tuesday November 10, 2026 @11:00AM (#50442213)
EMCAScripts statements are enough, no need to redefine them in JSX.

  <div class="container">
    My list
    {
      list.map((item) => {
        let content = null;
        if (item.loading) {
          content = <p>Loading...</p>;
        } else if (item.error) {
          content = <p>Error loading item</p>;
        } else {
          content = <p>{item.description}</p>;
        }

        return (
          <>
            <h2>{item.name}</h2>
            {content}
          </>
        );
      })
    }
  </div>
VS

  <div class="container">
    My list
    @for(item in list) {
      <h2>{item.name}</h2>
      @if(item.loading){
        <p>Loading...</p>
      } @else if (item.error) {
        <p>Error loading item</p> 
      } @else {
        <p>{item.description}</p>
      }
    }
   </div>
I still don't see any limitation.
Re:Exact – a new cross platform UI framework by the Expo team by halflife on Tuesday November 10, 2026 @01:20PM (#50444100)
In my suggestion I demonstrated a theoretical approach to how I think JSX shouldve been done.

JSX eventually is not a templating engine, it’s just sugar over createComponent/createElement functions, and thats its downside, we are creating html components that need templates to render.