Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
React for Gutenberg, WordPress & Beyond - WordC...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Zac Gordon
October 06, 2018
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
React for Gutenberg, WordPress & Beyond - WordCamp Baltimore 2018
Zac Gordon
October 06, 2018
More Decks by Zac Gordon
See All by Zac Gordon
How We Can Make WordPress Better for the JAMstack
zgordon
0
340
Decoupled Days - JAMstack and WordPress for 2020
zgordon
0
200
The State of JavaScript and WordPress in 2020
zgordon
0
970
100 Things to Know About Building, Selling and Supporting Online Courses and Content
zgordon
0
690
Highly Dynamic WordPress Sites with Gatsby and WordPress
zgordon
0
1k
How the New Redux Based Data API is Changing Everything in WordPress*
zgordon
0
420
The Data API in WordPress - WCMIA 2019
zgordon
0
1.1k
Building Custom WordPress Blocks with React - WCPHX 2019
zgordon
0
94
WordCamp Seattle 2017 JavaScript Workshop
zgordon
0
1.1k
Other Decks in Technology
See All in Technology
EventBridge Connection
_kensh
5
680
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
660
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.9k
ルールやカスタム機能、どう活かす?ハンズオンで体感するIBM Bobの出力コントロール
muehara
1
130
Agentic Web
dynamis
1
200
なぜ Platform Engineering の土台に Kubernetes を選ぶのか
r4ynode
1
560
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
1.1k
RSA暗号を手計算したくなること、ありますよね?? (20260615_orestudy6_rsa)
thousanda
0
160
2026TECHFRESH畢業分享會 - Lightning Talk - E起 See See : 電商推薦讀心術? 數據說了算
line_developers_tw
PRO
0
660
Amazon Bedrock AgentCore ワークショップ JAWS UG TOHOKU / amazon-bedrock-agentcore-workshop-jawsug-tohoku-2026
gawa
9
610
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.9k
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
3
2.1k
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Faster Mobile Websites
deanohume
310
31k
Statistics for Hackers
jakevdp
799
230k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
270
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
Typedesign – Prime Four
hannesfritz
42
3.1k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
280
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
420
Code Review Best Practice
trishagee
74
20k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
Transcript
javascriptforwp.com/bmore @zgordon React for Gutenberg, WordPress & Beyond w Zac
Gordon
javascriptforwp.com/bmore @zgordon Hi! I’m Zac zacgordon.com
javascriptforwp.com/bmore @zgordon How & Why React is Included w WordPress
javascriptforwp.com/bmore @zgordon A bit of history..
javascriptforwp.com/bmore @zgordon Gutenberg is React Under the Hood
javascriptforwp.com/bmore @zgordon Built Decoupled Wired to WordPress
@zgordon javascriptforwp.com/bmore gutenberg-standalone.surge.sh
@zgordon javascriptforwp.com/bmore drupalgutenberg.org
javascriptforwp.com/bmore @zgordon Gutenberg Editor is a Modern React App
@zgordon javascriptforwp.com/bmore npmjs.com/~WordPress
@zgordon javascriptforwp.com/bmore
javascriptforwp.com/bmore @zgordon Better Standards for WordPress JavaScript
@zgordon javascriptforwp.com/bmore github.com/WordPress-Coding-Standards/eslint-plugin-wordpress
javascriptforwp.com/bmore @zgordon Gutenberg Editor is a Modern React App
javascriptforwp.com/bmore @zgordon React in WordPress
javascriptforwp.com/bmore @zgordon The Great WordPress React Abstraction
@zgordon // Enqueue JS - React Dependency? wp_enqueue_script( 'myplugin-js', plugins_url(
null, __FILE__ ) . '/js/plugin.js', [ 'jquery' ] );
@zgordon // Enqueue JS - React Dependency? wp_enqueue_script( 'myplugin-js', plugins_url(
null, __FILE__ ) . '/js/plugin.js', [ 'react' ] );
@zgordon javascriptforwp.com/bmore In WordPress React == wp.element
@zgordon javascriptforwp.com/bmore github.com/WordPress/gutenberg/tree/master/packages/element
@zgordon javascriptforwp.com/bmore The Great WordPress React Abstraction
@zgordon // Normal React const el = React.createElement('h1', null, 'Welcome!');
// WordPress React const el = wp.element.createElement('h1', null, 'Welcome!');
@zgordon // Normal ReactDOM ReactDOM.render( el, document.getElementById( 'root' ) );
// WordPress ReactDOM wp.element.render( el, document.getElementById( ‘root' ) );
@zgordon javascriptforwp.com/bmore wp.element is Available in the DOM window object*
window.wp.element
@zgordon javascriptforwp.com/bmore gutenberg.local
@zgordon // WordPress React - Normal const el = wp.element.createElement('h1',
null, 'Welcome!'); // WordPress React - Destructured const { createElement } = wp.element; const el = createElement('h1', null, 'Welcome!');
javascriptforwp.com/bmore @zgordon To Use React Outside of Gutenberg
@zgordon // Enqueue JS - React Dependency? wp_enqueue_script( 'myplugin-js', plugins_url(
null, __FILE__ ) . '/js/plugin.js', [ 'wp-element' ] );
@zgordon javascriptforwp.com/bmore gutenberg.local
javascriptforwp.com/bmore @zgordon We Also Have JSX In WordPress
@zgordon <PanelBody> <TextControl label={ __( 'Text Field', 'domain' ) }
value={ textControl } onChange={ textControl =>" setAttributes( { textControl } ) } /> </PanelBody> <PanelBody> <TextareaControl label={ __( 'Text Area Field', 'domain' ) } value={ textareaControl } onChange={ textareaControl =>" setAttributes( { textareaControl } ) } /> </PanelBody>
@zgordon javascriptforwp.com/bmore You will need Babel to use JSX..
@zgordon javascriptforwp.com/bmore npmjs.com/package/@wordpress/babel-preset-default
@zgordon javascriptforwp.com/bmore npmjs.com/package/@wordpress/babel-plugin-import-jsx-pragma
@zgordon <PanelBody> <TextControl label={ __( 'Text Field', 'domain' ) }
value={ textControl } onChange={ textControl =>" setAttributes( { textControl } ) } /> <TextareaControl label={ __( 'Text Area Field', 'domain' ) } value={ textareaControl } onChange={ textareaControl =>" setAttributes( { textareaControl } ) } /> </PanelBody>
javascriptforwp.com/bmore @zgordon A React Component Library For WordPress!
@zgordon javascriptforwp.com/bmore wp.components
@zgordon const { Autocomplete, Button, CheckboxControl, ColorPalette, DropZone, FormToggle, Panel,
Popover, Spinner, TextControl, TextareaControl, Tooltip, } = wp.components; const CustomTooltip = () =>" ( <Tooltip text="More Info"> <Button isDefault> Hover for Tooltip </Button> </Tooltip> );
javascriptforwp.com/bmore @zgordon Redux in WordPress
@zgordon javascriptforwp.com/bmore github.com/WordPress/gutenberg/tree/master/packages/data#comparison-with-redux
@zgordon javascriptforwp.com/bmore Ability to Create Our Own Data Stores Using
WP Redux
@zgordon javascriptforwp.com/bmore github.com/WordPress/gutenberg/tree/master/packages/core-data
@zgordon javascriptforwp.com/bmore Use Data API Instead Of Your Own WP
REST API Calls *
@zgordon const { withSelect, withDispatch, } = wp.data;
@zgordon const { withSelect } = wp.data; function MyAuthorsListBase( {
authors } ) { return ( <ul> { authors.map( ( author ) =>" ( <li key={ author.id }>{ author.name }</li> ) ) } </ul> ); } const MyAuthorsList = withSelect( ( select ) =>" ( { authors: select( 'core' ).getAuthors(), } ) )( MyAuthorsListBase );
@zgordon const { withSelect } = wp.data; function MyPostsListBase( {
posts } ) { return ( <ul> { posts.map( ( post ) =>" ( <li key={ post.id }>{ post.title.rendered }</li> ) ) } </ul> ); } const MyPostList = withSelect( ( select ) =>" ( { posts: select( 'core' ).getEntityRecords( 'postType', 'post', { per_page: 5 } ) } ) )( MyPostsListBase );
@zgordon edit: withSelect( select =>" { return { posts: select(
'core' ).getEntityRecords( 'postType', 'post', { per_page: 5 } ) }; } )( ( { posts } ) =>" { return ( <ul> { posts.map( post =>" { return <li>{ post.title.rendered }</li>; }) } </ul> ); } )
@zgordon javascriptforwp.com/bmore npmjs.com/package/@wordpress/api-fetch
javascriptforwp.com/bmore @zgordon React in WP Immediate Future vs. Next Few
Years
javascriptforwp.com/bmore @zgordon Gutenberg “Block” Editor
javascriptforwp.com/bmore @zgordon Gutenberg “Block” Editor, Widgets, Customizer, Themes, Plugins, Decoupled
javascriptforwp.com/bmore @zgordon Do I Need to Learn All of This?
javascriptforwp.com/bmore @zgordon 20% OFF Gutenberg Course javascriptforwp.com/bmore Q&A