Osmose

I make websites and chiptunes!

  • he/him

AKAs:
Lapsed Neurotypical
JavaScript's Strongest Warrior
Fake Podcast Host
Thotleader
Vertically Integrated Boyfriend
Your Fave's Mutual
Certified 5x Severals by the RIAA
Inconsistently Medicated
The Source That Views Back
Carnally Known
The Alternative


Homepage
osmose.ceo/

posts from @Osmose tagged #react

also:

I forget if I vented about this before but again I'd like to make sure it is absolutely clear that React isn't, wasn't, and never was a library that claimed to or intended to make webpages faster.

Every performance improvement in React is meant to make it fast enough to be competitive vs non-React webpages. It is making up for its inherent slowness.

React is a one-way data binding library. It removes the need to worry about the DOM as a source of state in your app. It gets rid of you having to worry "Does the <ul id="todos"> DOM element contain the same todo items stored in my const todos = [] list? Has something changed the DOM and made them out-of-sync?" because now the DOM is always derived from your app state.

React will always be slower than having no framework and managing that yourself. React is a library meant to make developers' lives easier, not users'.

Go watch the original announcement at JSConfUS 2013. They spend most of the time talking about one-way data binding and only bring up the virtual DOM and reconciliation at the end as a way to explain how this obviously-slower technique of regenerating the DOM all the time can be fast enough to be usable.



Osmose
@Osmose

JSX as syntactic sugar for general function calls, with the children being a block/closure argument like Ruby/Kotlin.

<_.partition collection={[1, 2, 3, 4]}>{it % 2}</>

I kinda like the forced kwargs aspect of it.


Osmose
@Osmose
function ReactComponent*(props) {
  // Do whatever setup React needs for hooks and such
  yield props; // Calls the subfunction
  // Do whatever cleanup React needs for hooks and such
}

function Group({heading, members}) extends ReactComponent {
  return (
    <div>
      <h1>{heading}</h1>
      <ul>
        {members.map(member => <li>{member}</li>}
      </ul>
    </div>
  );
}

function App() extends ReactComponent {
  const [odds, evens] = <_.partition collection={[1, 2, 3, 4]}>{it % 2}</>;
  return (
    <>
      <Group heading="Odds" members={odds} />
      <Group heading="Events" members={evens} />
    </>
  );
}

I expect a call from TC39 by the end of the day.