Description
Building on our simple React app, Aurooba demonstrates a component and sets up state to track variables. While discussing return statements, Brian cringes about JSX and mixing HTML with JavaScript. They also discuss how a function can return more than one variable in modern JavaScript.
A full transcript of the episode is available on the website. Watch the video podcast on YouTube and subscribe to our channel and newsletter to hear about episodes (and more) first!
The source code from the episode – https://github.com/viewSourcePodcast/viewSource-blocks/tree/add/accordion-block
@wordpress/scripts – https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/
@wordpress/element - https://developer.wordpress.org/block-editor/reference-guides/packages/packages-element/
Brian's website – https://www.briancoords.com
Aurooba's website – https://aurooba.com
(00:00) - Introduction
(01:10) - The Return in React Components
(07:39) - Setting up State with @wordpress/element
(10:25) - Destructuring and Getting Multiple Values from a Function
(14:05) - Calling Event Functions in JSX
(16:06) - Frontend Recap and Next Steps
Aurooba and Brian dig deeper into the WordPress Interactivity API. This episode mostly focuses on the HTML directives they used in their custom blocks, how they work with block markup, and how the Interactivity API uses them to hydrate data. Along the way they also compare it to other templating...
Published 04/29/24
So begins another project! This time back inside WordPress. Brian and Aurooba discuss the Interactivity API in WordPress. They explore how to use the API, the challenges they faced, and the benefits it provides. They also touch on JavaScript modules and how they are used in the context of the...
Published 04/15/24