meta_pixel
Tapesearch Logo
Log in
Syntax - Tasty Web Development Treats

State In React

Syntax - Tasty Web Development Treats

Wes Bos

Tech News, Technology, News

4.91.2K Ratings

🗓️ 14 August 2019

⏱️ 55 minutes

🧾️ Download transcript

Summary

In this episode of Syntax, Scott and Wes talk about state in React: local state, global state, UI state, data state, caching, API data and more! LogRocket - Sponsor LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax. Freshbooks - Sponsor Get a 30 day free trial of Freshbooks at freshbooks.com/syntax and put SYNTAX in the “How did you hear about us?” section. Show Notes 3:38 - What is state? 4:58 - What kind of things are kept in state? Data Temporary client side data From forms, button clicks, etc. Cached server data Data from API UI status AKA isModalOpen isToggled 12:48 - Global state vs. Local state Ask yourself: does the data need to be accessed outside this component? If data does need to be accessed a little higher, you can simply move where that state lives. React calls this “lifting state”. Do you count Apollo API calls as global state? 21:15 - Managing Local state useState, setState Passing state & update functions down State machines 31:12 - Approaches to Global state Redux Complicated, hard to learn Very useful, organized and structured Actions, reducers and more Time traveling do to nature of store Immutability Tons of Redux based hooks libs Mobx Based on Observables An Observable is like a Stream and allows to pass zero or more events where the callback is called for each event. Often Observable is preferred over Promise because it provides the features of Promise and more. Context Functions just work and update global state. Downside is there are no fancy tools Apollo Apollo quires for data in global cache Apollo client for global UI state Not quite there, isn’t super elegant Links Thinkso Learn Node! Meteor Session xstate-react React Context Mobx easy-peasy hype.codes providerCompose.js Relay React Podcast ××× SIIIIICK ××× PIIIICKS ××× Scott: Command Line Heroes Wes: MASSDROP CTRL MECHANICAL KEYBOARD Shameless Plugs Scott: LevelUpTutorials - Gatsby Ecommerce — Subscribe before price goes up! Wes: All Courses — Use the coupon code ‘Syntax’ for $10 off! Tweet us your tasty treats! Scott’s Instagram LevelUpTutorials Instagram Wes’ Instagram Wes’ Twitter Wes’ Facebook Scott’s Twitter Make sure to include @SyntaxFM in your tweets

Transcript

Click on a timestamp to play from that location

0:00.0

You're listening to Syntax. The Podcast with the Tastiest Web Development treats out there.

0:06.0

Strap yourself in and get ready. Here is Scott Telinsky and West Boss.

0:10.5

Welcome to Syntax. This is the podcast with the tastiest web development treats out there. Today we are talking about state in react.

0:19.0

Such a simple thing, but there's very many ways to approach it. Lots of different things out there. So we're

0:25.6

going to try to dive into local state and global state and UI state and data state and

0:31.4

caching and API data and man there's just tons of stuff to do here so yeah

0:36.8

with me as always is Mr. Tolinsky how you doing today Scott Tolinskyinsky? Hey, I'm doing okay. I'm doing pretty good. My

0:47.2

office is like under a state of transition so things are a little chaotic. They're

0:52.1

Brittany and Kevin chaotic.

0:53.9

And do you remember that show?

0:56.8

Brittany and Kevin now.

0:58.2

There was a show it was about Brittany Spears

1:00.0

and Kevin Federline?

1:03.0

I don't know if that's his name.

1:04.4

But it was called Britney and Kevin Kiotic.

1:06.4

So I can't say the word chaotic without prefixing it

1:09.8

with Britney and Kevin for some reason.

1:12.9

But no, no, dude, a huge bummer.

1:14.8

Yesterday, somebody rear-ended Courtney

1:17.8

and her friend and Brooklyn were in the car,

1:20.9

and her car's all janked up, and you I feel so bad I was like in in total like

1:25.8

dad rage mode driving out there and I was like I was gonna crack some skulls I'm just

...

Please login to see the full transcript.

Disclaimer: The podcast and artwork embedded on this page are from Wes Bos, and are the property of its owner and not affiliated with or endorsed by Tapesearch.

Generated transcripts are the property of Wes Bos and are distributed freely under the Fair Use doctrine. Transcripts generated by Tapesearch are not guaranteed to be accurate.

Copyright © Tapesearch 2026.