Managing State in React

Опубликовано: 25 Ноябрь 2024
на канале: viewSource
191
10

Aurooba and Brian are back with the series on building with React inside WordPress! In this episode, they dive into how state works in React and why ternary expressions are more common in JavaScript than they are in PHP. They break down the code of the accordion they've been building in React over the course of this series, focussing on exactly how it manages which item stays open or closed.

A full transcript of the episode is available on the website. Watch the video podcast on YouTube and subscribe to our channel and newsletter (https://viewsource.fm/subscribe) to hear about episodes (and more) first!

The code from the episode – https://github.com/viewSourcePodcast/...
The React series playlist –    • Getting started with React inside Wor...  
The episode on debugging in WordPress –    • Tips on how to to debug your WordPres...  
Brian's website – https://www.briancoords.com
Aurooba's website – https://aurooba.com

00:00:00 Introduction
00:00:25 Recap of where we are in the React series
00:02:03 Rerenders in React
00:06:39 What is state in React?
00:10:40 The expand() function
00:14:30 How a ternary expression works
00:16:55 Why are ternary expressions more common in JavaScript?
00:20:33 Where it makes sense to use a ternary expression
00:26:09 What's next?
00:27:28 Taking the editing experience into account when making a block