BUILD REACT INTO THE BROWSER YOU COWARDS
— Laurie Voss @ Web Directions (@seldo) June 2, 2019
Ignoring @seldo's intemperate, self-owning ad-homenim, let's consider what it might mean...there are many versions! A few:
— Alex Russell (@slightlylate) June 3, 2019
1.) *literally do exactly this*
2.) add building blocks
3.) start from syntax https://t.co/B8YniqmhLd
JavaScript.#UseThePlatform
— Horse JS (@horse_js) May 19, 2016
The Polymer App Toolbox is a set of loosely-coupled components and tools to make it easy to create a Progressive Web Application using the modern platform
BUILD REACT INTO THE BROWSER YOU COWARDS
— Laurie Voss @ Web Directions (@seldo) June 2, 2019
class HelloMessage extends React.Component { render() { return <p>uSe THe PLaTfORm yOu {this.props.name}</p> ); } } ReactDOM.render( <HelloMessage name="cOWarDs" />, document.getElementById('hello-example') );
How much less code could we send down the wire? How much could we cut down on JavaScript parsing if React were built in?
How much does it cost to supply 5,101,516 downloads of React every week?
SyntheticEvent
s?React-flavored JSX is not HTML and would require major updates to be integrated into the Web. And we'd all have to rewrite our applications. No thanks.
I mean why? It's a pretty big wrapper and not everybody needs it.
One way to do updates + diffing. Fast enough for many applications. Too slow for others! Not the only or "best" way.
Take this side-by-side comparison. With just 200 moving elements, React's update mechanism completely shits the bed. You have to bypass the virtual DOM and do it yourself — it's nice that you *can*, but it's pretty unfortunate. https://t.co/MzcB9gbTG2
— Rich Harris (@Rich_Harris) June 5, 2019
The one with Hooks? An older version? What happens to unmaintained React apps? Do they just break?
(We've been here before)
What do you mean put jQuery in the browser? Which version? Which pieces?
$()
→ querySelectorAll()
$el.on()
→ Element.addEventListener()
$el.toggleClass()
→ Element.classList.toggle()
Translation: use lit-html, LitElement, and Google's other tools for building "Web Components"
Framework fatique is a real concern. We can't probably shouldn't re-write our apps every year.
— Rich Harris (@Rich_Harris) June 20, 2019
(but React is not 100% to blame)
Application code is one small part of the equation
Lots of work to do that is easier and more impactful than putting React in the browser or reinventing the Web platform
Shubhie is leading efforts to improve how scheduling works in the browser, so that all framework authors can take advantage of better performance when updating the DOM
Whether you use Ember, React, Svelte, Vue, or whatever, there is an opportunity for you to see the benefits of these optimizations
Focus on standardizing new low-level capabilities in order to: