DEV Community

Cover image for React 18 Alpha is out! Now what?

React 18 Alpha is out! Now what?

Cassidy Williams on June 08, 2021

Hello! They kept us in Suspense long enough, but HECK React developers have some new features to play with!! The best part: Almost all of the bene...
Collapse
 
ajcwebdev profile image
ajcwebdev

Thanks for the write up Cassidy and thank you to the React team for all the work they've done to include the community in these processes.

Also watch out for the capital D in getElementById!

const root = ReactDOM.createRoot(document.getElementByID('root'));
Enter fullscreen mode Exit fullscreen mode

Should be:

const root = ReactDOM.createRoot(document.getElementById('root'));
Enter fullscreen mode Exit fullscreen mode
Collapse
 
cassidoo profile image
Cassidy Williams

Good call, updating!

Collapse
 
ajcwebdev profile image
ajcwebdev

I created a little sample application as well using Vite with Netlify deployment included.

github.com/ajcwebdev/ajcwebdev-rea...

dev.to/ajcwebdev/a-first-look-at-r...

ajcwebdev-react18.netlify.app/

Collapse
 
aslemammad profile image
Mohammad Bagher Abiyat

This shows that Cassidy hasn't writtien any vanilla js for monthsπŸ˜‚

Thread Thread
 
ajcwebdev profile image
ajcwebdev • Edited

Hey, I actually had to search StackOverflow to figure out the error and had never once thought about the casing of DOM methods.

Collapse
 
ben profile image
Ben Halpern

This is the first time I've carefully read about Suspense (I've seen it around but always skimmed past actually understanding it).

I like the pattern. It seems like a high value-add to the ecosystem.

Collapse
 
cassidoo profile image
Cassidy Williams

Yes! I think it was much more nebulous before because of the lack of full support, but now it's something that has really practical applications.

Collapse
 
ben profile image
Ben Halpern

Suspense is labeled "experimental" in Preact... I imagine it will eventually land there too.

Collapse
 
stolinski profile image
Scott Tolinski

Awesome write up!

Collapse
 
cassidoo profile image
Cassidy Williams

Thank you Scott!

Collapse
 
trangchongcheng profile image
cucheng

Thank again

Collapse
 
larsejaas profile image
Lars Ejaas

Sorry but you missed a HUGE part for anyone using frameworks like gatsby.js and next.js!! React.lazy now works with serverside rendering out of the box! No more 'funny code' to check if the code is running on a server or in the browser, it just works out of the box. This can be used in several ways, but an example would to defer parts of the code that isn't necessary when initially loading a webpage because it's used for 'below the fold' content. This stuff is super powerful when optimizing web pages for speed and SEO.

Collapse
 
anthonycook profile image
Anthony Cook

I can't wait for React 18! The "suspense" is killing me! πŸ˜†

Collapse
 
wintercounter profile image
Victor Vincent

I really would like to see Suspense support ordenary promises using a hook based API. At it's current form we will still need custom wrappers around Apollo, React Query, etc. during SSR, which we can simply avoid and fine-tune with a few API changes.

Collapse
 
shrutikapoor08 profile image
Shruti Kapoor

Love how you explained it Cassidy and make it so easy to understand.

Collapse
 
etabrizi profile image
Emyr Tabrizi

Nice write up Cassidy, thanks for the update.

Collapse
 
thedaviddias profile image
David Dias

You are too fast Cassidy πŸ˜…

Collapse
 
ngduc profile image
Duc Ng

Great news.
Can't wait to work with the final version 18.
I've just played around with React 18, Typescript, Vite and Vercel, wrote about it here:
nnote.io/s/x4od5/try-react-18-with...

Collapse
 
sirdarknight profile image
SirDarknight

Why would someone use React in 2021 unless you're working on an existing project or your job requires it? Vue 3 and Svelte are so much better in every single way.

Collapse
 
paulm17 profile image
Paul • Edited

Have you used hooks? How about the eco-system?

I currently work with BlitzJS. It has Next.JS and React under the hood. I am 10x more productive than with Vue 2.

At this point, I couldn't care less about Vue 3. What does it bring to the table? Nothing.

Where is React-Query? Hmm? How about React-Table, React-Virtual, Final Form, Zod, just to name a few. Sure, I can see you are scrambling now on Google to find their Vue equivilents. But with BlitzJS, you no longer have to think in terms of FE and BE. I can do things like putting up a complex form, validating it on the FE AND BE and then adding to the database with full error capability. Oh and in under 2 minutes. Not 10 mins or so with Vue or Svelte.

I shudder to think the steps involved to do this with Vue 3 or Svelte.

Also Typescript, omg. Sure Vue3 has it now and Svelte they are talking about it? Like I say, who cares.

I'm far more productive now than I ever was. Oh and we are talking from small apps, to small sites. To large very large and complex enterprise apps. Vue and Svelte fall apart when you go past the small stage. So many comments on HN from people who went from Vue to React with big apps.

Collapse
 
bobgravity1 profile image
bobgravity1

dude... stfu lol

Collapse
 
akdevcraft profile image
AK DevCraft

Nice and concise information, no one can wrap up any release in single write up. At least good to know news stuff without looking into complete release details.

Collapse
 
elratondefuego profile image
David Cho-Lerat

Thanks Cassidy. Small typo : "I want to reiterate this" (no "n"). The startTransition feature will come in handy for sure, among other things. Will keep watching this space!