SlideShare a Scribd company logo
Digging into Gutenberg
Imran Sayed
@imranhsayed
Ajit Bohra
@ajitbohra
WordPress Meetu
Saturday, 14th Mar 202
10:30 am UTC
Welcome To WordPress
What WordPress can do
▪ Blogs
▪ LMS
▪ Ecommerce
3
Block Editor
Gutenberg Mental Modal
https://atomicdesign.bradfrost.com/table-of-contents/
Look Beyond Blocks
Diving into
Gutenberg Core
Gutenberg Packages
▪ Packages can be used independently
▪ Can be used outside WordPress
▪ Have documentation.
▪ https://github.com/WordPress/gutenberg/tree/maste
r/packages
8
Composition of packages
Common Packages
Common Packages
▪ @wordpress/components
▪ @wordpress/block-editor
▪ @wordpress/data
▪ @wordpress/rich-text
▪ @wordpress/i118n
11
wordpress.github.io/gutenberg - View components in Storybook
12
Tools
Build Tools
▪ @wordpress/scripts
▪ @wordpress/create-block
▪ @wordpress/env
14
Editor and data ?
1.
WordPress Data
WordPress Data Module
▪ Serves as a hub to manage application state for both
plugins and WordPress itself
▪ Provides tools to manage data within and between
distinct modules.
▪ designed as a modular pattern for organizing and
sharing data
▪ Its implemented atop redux.
17
What is Redux?
A state management tool for javascript apps.
19
20
Store
Cookie Maker
21
Cookie Maker
Distributor
22
Distributor
Store
23
Distributor
Store
Cookie Maker Distributor
24
Store
26
Distributor
Store
Cookie Maker
( Action Creator )
Distributor
( Reducer )
Food: Payload
Subscriber
Instruction:
Dispatch
Actions, Reducers, Store, State
Triggers an action Create & Dispatch an Action
Updates store with
new state based on
action type
Defines
Why use Redux?
▪ Allows you to share the state between components
▪ It integrates nicely with React. Can use it with any
other view library. It allow us to track changing data.
▪ When we have big complicated data for complex
applications.
28
Why use Redux?
▪ Any component can pull any piece of data from the
redux store. So data needs to be shared between
multiple components.
▪ Run in different environments (client, server, and
native), and are easy to test.
29
Why use Redux?
▪ Reusing the components because they no longer are
dependent to get the props from their parents, they
can all get their state values as props ,from a single
redux store
30
WordPress Data Module
▪ Simple enough to satisfy the needs of a small plugin
▪ Scalable to serve the requirements of a complex
single-page application
▪ Built upon and shares many of the same core
principles of Redux
▪ But it's only merely ‘Redux for WordPress’
▪ Includes a few of its own distinguishing
characteristics
31
3.
WordPress Data Store
WordPress Data Store
▪ Default stores
▪ Custom store
33
WordPress Data Store
▪ Mostly used packages
▫ core
▫ core/blocks
▫ core/block-editor
▫ core/edit-post
▪ More
▫ core/notices
34
3.
Retrieving Data
( using Selectors )
Retrieving Data
▪ wp.data.select( 'namespace' ).selector( param );
Get edited and current post data.
▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' );
▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'excerpt' );
▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'featured_media' )
▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'content' );
36
Retrieving Data
Get post meta
▪ wp.data.select( 'core/editor' ).getCurrentPost().meta
Get settings
▪ wp.data.select( 'core/block-editor' ).getSettings();
▪ wp.data.select( 'core/block-editor' ).getBlock( ‘client-id’ );
Get WordPress Data
▪ wp.data.select( 'core' ).getEntityRecords( 'postType', 'post' );
▪ wp.data.select( 'core' ).getAuthors();
▪ wp.data.select( 'core' ).getTaxonomies()
37
4.
Updating Data ( using
actions )
Updating Data
▪ wp.data.dispatch( 'namespace' ).action( params );
Update current post data.
▪ wp.data.dispatch( 'core/editor' ).editPost( { title: 'My New Title' } );
▪ wp.data.dispatch( 'core/editor' ).editPost( { excerpt: 'My excerpt' } );
▪ wp.data.dispatch( 'core/editor' ).editPost( { featured_media: imageID } );
Update data
▪ wp.data.dispatch('core/notices').createNotice( 'success', 'Here is our notice!'
);
39
Updating Data
Update current post data.
▪ wp.data.dispatch( 'core/editor' ).lockPostSaving()
▪ wp.data.dispatch( 'core/editor' ).unlockPostSaving();
40
5.
Subscribe To Any Change.
Subscribe to any change - Saving Post
wp.data.subscribe( () => {
const isSavingPost = wp.data.select( 'core/editor').isSavingPost();
const isAutoSavingPost = wp.data.select( 'core/editor').isAutosavingPost();
// Update post data when the post is saving.
if ( isSavingPost && ! isAutoSavingPost ) {
// Do something
} } );
42
Subscribe to any change = Typing
wp.data.select( 'core/block-editor' ).isTyping();
wp.data.subscribe( () => {
const isTyping = wp.data.select( 'core/block-editor' ).isTyping();
// Get the post title when user is typing, and do something
if ( isTyping ) {
const title = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' );
console.warn( 'Typing..', title );
} } );
43
2.
WordPress Data Module vs
Redux
Let’s start with the first set of slides
WordPress Data Module Vs Redux - Similarities
▪ Many of the same core principles like:
▫ Single store object.
▫ State is changed by emitting an action.
▫ Making state changes with Reducers.
▪ Many of the same API method naming like:
▫ Dispatch, subscribe, createStore etc.
▪ Implemented atop Redux
45
WordPress Data Module Vs Redux - Difference
▪ Differs is in establishing a modularization pattern for
creating separate but interdependent stores.
▪ Higher-order components were created to
complement this distinction
46
Redux
WordPress Data Module Vs Redux - Difference
WordPress Data Module
47
▪ A subscribe listener is called on
every dispatch, regardless of
state change
▪ A subscriber is only called
when state has changed
▪ In React Redux, a
mapStateToProps function
must return an object.
▪ A withSelect mapping function
can return undefined if it has
no props to inject.
Redux
WordPress Data Module Vs Redux - Difference
WordPress Data Module
48
▪ In React Redux, the
mapDispatchToProps
argument can be defined as an
object or a function.
▪ The withDispatch higher-order
component creator must be
passed a function.
7.
Current State of Gutenberg
What features have currently been added
8.
Future of Gutenberg
Phase 2
https://wordpress.org/about/roadmap/
https://github.com/WordPress/gutenberg/blob/master/docs/roadmap.md
9.
Contributing to Gutenberg
Contributing to gutenberg
▪ Guide https://developer.wordpress.org/block-
editor/contributors/
52
Contributing to gutenberg
▪ Contribute to :
● Good first issue https://mkaz.blog/code/good-first-issue-
on-gutenberg/
● Documentation
● Design
● Adding Stories to StoryBook
https://mkaz.blog/code/coding-a-storybook-story/
● Testing
● Write Test Cases
● PR Reviews
53
54
THANKS!
ANY QUESTIONS?
You can find us on Twitter at:
▪ @imranhsayed
▪ @ajitbohra

More Related Content

What's hot

Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)
Frazer Clement
 
The benefits of My sql
The benefits of My sqlThe benefits of My sql
The benefits of My sql
CacheWorks©
 
MySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersMySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and Developers
Ronald Bradford
 
Introduction Mysql
Introduction Mysql Introduction Mysql
Introduction Mysql
Gerben Menschaert
 
Drupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalDrupal Now! - Introduction to Drupal
Drupal Now! - Introduction to Drupal
Alozie Nwosu
 
Bacula4
Bacula4Bacula4
Bacula4
Elsayed Atef
 
SQL Server 2014 Hybrid Cloud Features
SQL Server 2014 Hybrid Cloud FeaturesSQL Server 2014 Hybrid Cloud Features
SQL Server 2014 Hybrid Cloud FeaturesGuillermo Caicedo
 
Local Drupal MultiSite Set-up
Local Drupal MultiSite Set-upLocal Drupal MultiSite Set-up
Local Drupal MultiSite Set-up
Manuel Felix G. Abejo Jr.
 
Windows Azure Drive
Windows Azure DriveWindows Azure Drive
Windows Azure Drive
Pavel Revenkov
 
your browser, my storage
your browser, my storageyour browser, my storage
your browser, my storage
Francesco Fullone
 
UKOUG 2011: MySQL Architectures for Oracle DBA's
UKOUG 2011: MySQL Architectures for Oracle DBA'sUKOUG 2011: MySQL Architectures for Oracle DBA's
UKOUG 2011: MySQL Architectures for Oracle DBA'sFromDual GmbH
 
[B5]memcached scalability-bag lru-deview-100
[B5]memcached scalability-bag lru-deview-100[B5]memcached scalability-bag lru-deview-100
[B5]memcached scalability-bag lru-deview-100NAVER D2
 
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
 MySQL PHP native driver  : Advanced Functions / PHP forum Paris 2013   MySQL PHP native driver  : Advanced Functions / PHP forum Paris 2013
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
Serge Frezefond
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
Tushar Chauhan
 
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUGEmbracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Keith Hollman
 
MaxScale - the pluggable router
MaxScale - the pluggable routerMaxScale - the pluggable router
MaxScale - the pluggable router
MariaDB Corporation
 
Sql azure federations
Sql azure federations Sql azure federations
Sql azure federations Pavel Tsukanov
 
Linux17 MySQL_installation
Linux17 MySQL_installationLinux17 MySQL_installation
Linux17 MySQL_installation
Jainul Musani
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
eLiberatica
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
Giuseppe Maxia
 

What's hot (20)

Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)
 
The benefits of My sql
The benefits of My sqlThe benefits of My sql
The benefits of My sql
 
MySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersMySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and Developers
 
Introduction Mysql
Introduction Mysql Introduction Mysql
Introduction Mysql
 
Drupal Now! - Introduction to Drupal
Drupal Now! - Introduction to DrupalDrupal Now! - Introduction to Drupal
Drupal Now! - Introduction to Drupal
 
Bacula4
Bacula4Bacula4
Bacula4
 
SQL Server 2014 Hybrid Cloud Features
SQL Server 2014 Hybrid Cloud FeaturesSQL Server 2014 Hybrid Cloud Features
SQL Server 2014 Hybrid Cloud Features
 
Local Drupal MultiSite Set-up
Local Drupal MultiSite Set-upLocal Drupal MultiSite Set-up
Local Drupal MultiSite Set-up
 
Windows Azure Drive
Windows Azure DriveWindows Azure Drive
Windows Azure Drive
 
your browser, my storage
your browser, my storageyour browser, my storage
your browser, my storage
 
UKOUG 2011: MySQL Architectures for Oracle DBA's
UKOUG 2011: MySQL Architectures for Oracle DBA'sUKOUG 2011: MySQL Architectures for Oracle DBA's
UKOUG 2011: MySQL Architectures for Oracle DBA's
 
[B5]memcached scalability-bag lru-deview-100
[B5]memcached scalability-bag lru-deview-100[B5]memcached scalability-bag lru-deview-100
[B5]memcached scalability-bag lru-deview-100
 
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
 MySQL PHP native driver  : Advanced Functions / PHP forum Paris 2013   MySQL PHP native driver  : Advanced Functions / PHP forum Paris 2013
MySQL PHP native driver : Advanced Functions / PHP forum Paris 2013
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA -   UKOUGEmbracing Database Diversity: The New Oracle / MySQL DBA -   UKOUG
Embracing Database Diversity: The New Oracle / MySQL DBA - UKOUG
 
MaxScale - the pluggable router
MaxScale - the pluggable routerMaxScale - the pluggable router
MaxScale - the pluggable router
 
Sql azure federations
Sql azure federations Sql azure federations
Sql azure federations
 
Linux17 MySQL_installation
Linux17 MySQL_installationLinux17 MySQL_installation
Linux17 MySQL_installation
 
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
"Advanced MySQL 5 Tuning" by Michael Monty Widenius @ eLiberatica 2007
 
Dbdeployer
DbdeployerDbdeployer
Dbdeployer
 

Similar to Digging Into Gutenberg

Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
nuppla
 
WEBPACK
WEBPACKWEBPACK
WEBPACK
home
 
Containerizing ContentBox CMS
Containerizing ContentBox CMSContainerizing ContentBox CMS
Containerizing ContentBox CMS
Gavin Pickin
 
13 things every developer should know about their database to run word press ...
13 things every developer should know about their database to run word press ...13 things every developer should know about their database to run word press ...
13 things every developer should know about their database to run word press ...
Seravo
 
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Andrew Duthie
 
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 minsChandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 minswpnepal
 
Wordpress
WordpressWordpress
Wordpress
samirlakhanistb
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
Nuvole
 
WordPress Optimization & Security - ThinkVisibility 2012, Leeds
WordPress Optimization & Security - ThinkVisibility 2012, LeedsWordPress Optimization & Security - ThinkVisibility 2012, Leeds
WordPress Optimization & Security - ThinkVisibility 2012, Leeds
Bastian Grimm
 
Worcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20minsWorcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20minsChandra Prakash Thapa
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
Otto Kekäläinen
 
ITB2019 Containerizing ContentBox CMS - Gavin Pickin
ITB2019 Containerizing ContentBox CMS - Gavin PickinITB2019 Containerizing ContentBox CMS - Gavin Pickin
ITB2019 Containerizing ContentBox CMS - Gavin Pickin
Ortus Solutions, Corp
 
WordPress Optimization & Security - LAC 2013, London
WordPress Optimization & Security - LAC 2013, LondonWordPress Optimization & Security - LAC 2013, London
WordPress Optimization & Security - LAC 2013, London
Bastian Grimm
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
Bastian Grimm
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
DrupalDay
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
rtCamp
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
ssuser65180a
 
Dataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStoreDataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStore
Vikalp Bhalia
 

Similar to Digging Into Gutenberg (20)

Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
 
WEBPACK
WEBPACKWEBPACK
WEBPACK
 
Containerizing ContentBox CMS
Containerizing ContentBox CMSContainerizing ContentBox CMS
Containerizing ContentBox CMS
 
13 things every developer should know about their database to run word press ...
13 things every developer should know about their database to run word press ...13 things every developer should know about their database to run word press ...
13 things every developer should know about their database to run word press ...
 
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
 
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 minsChandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
 
Wordpress
WordpressWordpress
Wordpress
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
WordPress Optimization & Security - ThinkVisibility 2012, Leeds
WordPress Optimization & Security - ThinkVisibility 2012, LeedsWordPress Optimization & Security - ThinkVisibility 2012, Leeds
WordPress Optimization & Security - ThinkVisibility 2012, Leeds
 
Worcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20minsWorcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20mins
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
ITB2019 Containerizing ContentBox CMS - Gavin Pickin
ITB2019 Containerizing ContentBox CMS - Gavin PickinITB2019 Containerizing ContentBox CMS - Gavin Pickin
ITB2019 Containerizing ContentBox CMS - Gavin Pickin
 
WordPress Optimization & Security - LAC 2013, London
WordPress Optimization & Security - LAC 2013, LondonWordPress Optimization & Security - LAC 2013, London
WordPress Optimization & Security - LAC 2013, London
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
 
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
Managing a WordPress Site as a Composer Project by Rahul Bansal @ WordCamp Na...
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
 
Zend
ZendZend
Zend
 
Dataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStoreDataweave Libraries and ObjectStore
Dataweave Libraries and ObjectStore
 

More from Imran Sayed

Docker with WordPress
Docker with WordPressDocker with WordPress
Docker with WordPress
Imran Sayed
 
Why Progressive Web Apps For WordPress - WordCamp Finland
Why Progressive Web Apps For WordPress - WordCamp FinlandWhy Progressive Web Apps For WordPress - WordCamp Finland
Why Progressive Web Apps For WordPress - WordCamp Finland
Imran Sayed
 
Custom gutenberg block development in react
Custom gutenberg block development in reactCustom gutenberg block development in react
Custom gutenberg block development in react
Imran Sayed
 
Fastest Way of Creating Gutenberg Blocks - WordCamp Rochester
Fastest Way of Creating Gutenberg Blocks - WordCamp RochesterFastest Way of Creating Gutenberg Blocks - WordCamp Rochester
Fastest Way of Creating Gutenberg Blocks - WordCamp Rochester
Imran Sayed
 
Harness The Power Of ACF For Gatsby and WordPress
Harness The Power Of ACF For Gatsby and WordPressHarness The Power Of ACF For Gatsby and WordPress
Harness The Power Of ACF For Gatsby and WordPress
Imran Sayed
 
Improving Your Debugging Skills In WordPress
Improving Your Debugging Skills In WordPressImproving Your Debugging Skills In WordPress
Improving Your Debugging Skills In WordPress
Imran Sayed
 
Build Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPressBuild Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPress
Imran Sayed
 
Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020
Imran Sayed
 
Fastest Way Of Creating Gutenberg Blocks With Minimal JavaScript Knowledge ...
Fastest Way Of Creating  Gutenberg Blocks  With Minimal JavaScript Knowledge ...Fastest Way Of Creating  Gutenberg Blocks  With Minimal JavaScript Knowledge ...
Fastest Way Of Creating Gutenberg Blocks With Minimal JavaScript Knowledge ...
Imran Sayed
 
Why progressive web apps for word press wc-ahemdabad
Why progressive web apps for word press wc-ahemdabadWhy progressive web apps for word press wc-ahemdabad
Why progressive web apps for word press wc-ahemdabad
Imran Sayed
 
Build fast word press site in react in 30 mins with frontity
Build fast word press site in react in 30 mins   with frontityBuild fast word press site in react in 30 mins   with frontity
Build fast word press site in react in 30 mins with frontity
Imran Sayed
 
Build Fast WordPress Site With Gatsby
Build Fast WordPress Site With GatsbyBuild Fast WordPress Site With Gatsby
Build Fast WordPress Site With Gatsby
Imran Sayed
 
Why Progressive Apps For WordPress?
Why Progressive Apps For WordPress?Why Progressive Apps For WordPress?
Why Progressive Apps For WordPress?
Imran Sayed
 
Creating Gutenberg Blocks With ACF
Creating Gutenberg Blocks With ACFCreating Gutenberg Blocks With ACF
Creating Gutenberg Blocks With ACF
Imran Sayed
 
Custom gutenberg block development with React
Custom gutenberg block development with ReactCustom gutenberg block development with React
Custom gutenberg block development with React
Imran Sayed
 
SSR with React - Connecting Next.js with WordPress
SSR with React - Connecting Next.js with WordPressSSR with React - Connecting Next.js with WordPress
SSR with React - Connecting Next.js with WordPress
Imran Sayed
 
React with WordPress : Headless CMS
React with WordPress : Headless CMSReact with WordPress : Headless CMS
React with WordPress : Headless CMS
Imran Sayed
 
React Workshop: Core concepts of react
React Workshop: Core concepts of reactReact Workshop: Core concepts of react
React Workshop: Core concepts of react
Imran Sayed
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
Imran Sayed
 
React workshop
React workshopReact workshop
React workshop
Imran Sayed
 

More from Imran Sayed (20)

Docker with WordPress
Docker with WordPressDocker with WordPress
Docker with WordPress
 
Why Progressive Web Apps For WordPress - WordCamp Finland
Why Progressive Web Apps For WordPress - WordCamp FinlandWhy Progressive Web Apps For WordPress - WordCamp Finland
Why Progressive Web Apps For WordPress - WordCamp Finland
 
Custom gutenberg block development in react
Custom gutenberg block development in reactCustom gutenberg block development in react
Custom gutenberg block development in react
 
Fastest Way of Creating Gutenberg Blocks - WordCamp Rochester
Fastest Way of Creating Gutenberg Blocks - WordCamp RochesterFastest Way of Creating Gutenberg Blocks - WordCamp Rochester
Fastest Way of Creating Gutenberg Blocks - WordCamp Rochester
 
Harness The Power Of ACF For Gatsby and WordPress
Harness The Power Of ACF For Gatsby and WordPressHarness The Power Of ACF For Gatsby and WordPress
Harness The Power Of ACF For Gatsby and WordPress
 
Improving Your Debugging Skills In WordPress
Improving Your Debugging Skills In WordPressImproving Your Debugging Skills In WordPress
Improving Your Debugging Skills In WordPress
 
Build Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPressBuild Modern Web Applications with React and WordPress
Build Modern Web Applications with React and WordPress
 
Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020Why progressive apps for WordPress - WordSesh 2020
Why progressive apps for WordPress - WordSesh 2020
 
Fastest Way Of Creating Gutenberg Blocks With Minimal JavaScript Knowledge ...
Fastest Way Of Creating  Gutenberg Blocks  With Minimal JavaScript Knowledge ...Fastest Way Of Creating  Gutenberg Blocks  With Minimal JavaScript Knowledge ...
Fastest Way Of Creating Gutenberg Blocks With Minimal JavaScript Knowledge ...
 
Why progressive web apps for word press wc-ahemdabad
Why progressive web apps for word press wc-ahemdabadWhy progressive web apps for word press wc-ahemdabad
Why progressive web apps for word press wc-ahemdabad
 
Build fast word press site in react in 30 mins with frontity
Build fast word press site in react in 30 mins   with frontityBuild fast word press site in react in 30 mins   with frontity
Build fast word press site in react in 30 mins with frontity
 
Build Fast WordPress Site With Gatsby
Build Fast WordPress Site With GatsbyBuild Fast WordPress Site With Gatsby
Build Fast WordPress Site With Gatsby
 
Why Progressive Apps For WordPress?
Why Progressive Apps For WordPress?Why Progressive Apps For WordPress?
Why Progressive Apps For WordPress?
 
Creating Gutenberg Blocks With ACF
Creating Gutenberg Blocks With ACFCreating Gutenberg Blocks With ACF
Creating Gutenberg Blocks With ACF
 
Custom gutenberg block development with React
Custom gutenberg block development with ReactCustom gutenberg block development with React
Custom gutenberg block development with React
 
SSR with React - Connecting Next.js with WordPress
SSR with React - Connecting Next.js with WordPressSSR with React - Connecting Next.js with WordPress
SSR with React - Connecting Next.js with WordPress
 
React with WordPress : Headless CMS
React with WordPress : Headless CMSReact with WordPress : Headless CMS
React with WordPress : Headless CMS
 
React Workshop: Core concepts of react
React Workshop: Core concepts of reactReact Workshop: Core concepts of react
React Workshop: Core concepts of react
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
 
React workshop
React workshopReact workshop
React workshop
 

Recently uploaded

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 

Recently uploaded (20)

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 

Digging Into Gutenberg

  • 1. Digging into Gutenberg Imran Sayed @imranhsayed Ajit Bohra @ajitbohra WordPress Meetu Saturday, 14th Mar 202 10:30 am UTC
  • 3. What WordPress can do ▪ Blogs ▪ LMS ▪ Ecommerce 3
  • 8. Gutenberg Packages ▪ Packages can be used independently ▪ Can be used outside WordPress ▪ Have documentation. ▪ https://github.com/WordPress/gutenberg/tree/maste r/packages 8
  • 11. Common Packages ▪ @wordpress/components ▪ @wordpress/block-editor ▪ @wordpress/data ▪ @wordpress/rich-text ▪ @wordpress/i118n 11
  • 12. wordpress.github.io/gutenberg - View components in Storybook 12
  • 13. Tools
  • 14. Build Tools ▪ @wordpress/scripts ▪ @wordpress/create-block ▪ @wordpress/env 14
  • 17. WordPress Data Module ▪ Serves as a hub to manage application state for both plugins and WordPress itself ▪ Provides tools to manage data within and between distinct modules. ▪ designed as a modular pattern for organizing and sharing data ▪ Its implemented atop redux. 17
  • 18. What is Redux? A state management tool for javascript apps.
  • 19. 19
  • 25.
  • 26. 26 Distributor Store Cookie Maker ( Action Creator ) Distributor ( Reducer ) Food: Payload Subscriber Instruction: Dispatch
  • 27. Actions, Reducers, Store, State Triggers an action Create & Dispatch an Action Updates store with new state based on action type Defines
  • 28. Why use Redux? ▪ Allows you to share the state between components ▪ It integrates nicely with React. Can use it with any other view library. It allow us to track changing data. ▪ When we have big complicated data for complex applications. 28
  • 29. Why use Redux? ▪ Any component can pull any piece of data from the redux store. So data needs to be shared between multiple components. ▪ Run in different environments (client, server, and native), and are easy to test. 29
  • 30. Why use Redux? ▪ Reusing the components because they no longer are dependent to get the props from their parents, they can all get their state values as props ,from a single redux store 30
  • 31. WordPress Data Module ▪ Simple enough to satisfy the needs of a small plugin ▪ Scalable to serve the requirements of a complex single-page application ▪ Built upon and shares many of the same core principles of Redux ▪ But it's only merely ‘Redux for WordPress’ ▪ Includes a few of its own distinguishing characteristics 31
  • 33. WordPress Data Store ▪ Default stores ▪ Custom store 33
  • 34. WordPress Data Store ▪ Mostly used packages ▫ core ▫ core/blocks ▫ core/block-editor ▫ core/edit-post ▪ More ▫ core/notices 34
  • 36. Retrieving Data ▪ wp.data.select( 'namespace' ).selector( param ); Get edited and current post data. ▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' ); ▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'excerpt' ); ▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'featured_media' ) ▪ wp.data.select( 'core/editor' ).getEditedPostAttribute( 'content' ); 36
  • 37. Retrieving Data Get post meta ▪ wp.data.select( 'core/editor' ).getCurrentPost().meta Get settings ▪ wp.data.select( 'core/block-editor' ).getSettings(); ▪ wp.data.select( 'core/block-editor' ).getBlock( ‘client-id’ ); Get WordPress Data ▪ wp.data.select( 'core' ).getEntityRecords( 'postType', 'post' ); ▪ wp.data.select( 'core' ).getAuthors(); ▪ wp.data.select( 'core' ).getTaxonomies() 37
  • 38. 4. Updating Data ( using actions )
  • 39. Updating Data ▪ wp.data.dispatch( 'namespace' ).action( params ); Update current post data. ▪ wp.data.dispatch( 'core/editor' ).editPost( { title: 'My New Title' } ); ▪ wp.data.dispatch( 'core/editor' ).editPost( { excerpt: 'My excerpt' } ); ▪ wp.data.dispatch( 'core/editor' ).editPost( { featured_media: imageID } ); Update data ▪ wp.data.dispatch('core/notices').createNotice( 'success', 'Here is our notice!' ); 39
  • 40. Updating Data Update current post data. ▪ wp.data.dispatch( 'core/editor' ).lockPostSaving() ▪ wp.data.dispatch( 'core/editor' ).unlockPostSaving(); 40
  • 42. Subscribe to any change - Saving Post wp.data.subscribe( () => { const isSavingPost = wp.data.select( 'core/editor').isSavingPost(); const isAutoSavingPost = wp.data.select( 'core/editor').isAutosavingPost(); // Update post data when the post is saving. if ( isSavingPost && ! isAutoSavingPost ) { // Do something } } ); 42
  • 43. Subscribe to any change = Typing wp.data.select( 'core/block-editor' ).isTyping(); wp.data.subscribe( () => { const isTyping = wp.data.select( 'core/block-editor' ).isTyping(); // Get the post title when user is typing, and do something if ( isTyping ) { const title = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' ); console.warn( 'Typing..', title ); } } ); 43
  • 44. 2. WordPress Data Module vs Redux Let’s start with the first set of slides
  • 45. WordPress Data Module Vs Redux - Similarities ▪ Many of the same core principles like: ▫ Single store object. ▫ State is changed by emitting an action. ▫ Making state changes with Reducers. ▪ Many of the same API method naming like: ▫ Dispatch, subscribe, createStore etc. ▪ Implemented atop Redux 45
  • 46. WordPress Data Module Vs Redux - Difference ▪ Differs is in establishing a modularization pattern for creating separate but interdependent stores. ▪ Higher-order components were created to complement this distinction 46
  • 47. Redux WordPress Data Module Vs Redux - Difference WordPress Data Module 47 ▪ A subscribe listener is called on every dispatch, regardless of state change ▪ A subscriber is only called when state has changed ▪ In React Redux, a mapStateToProps function must return an object. ▪ A withSelect mapping function can return undefined if it has no props to inject.
  • 48. Redux WordPress Data Module Vs Redux - Difference WordPress Data Module 48 ▪ In React Redux, the mapDispatchToProps argument can be defined as an object or a function. ▪ The withDispatch higher-order component creator must be passed a function.
  • 49. 7. Current State of Gutenberg What features have currently been added
  • 50. 8. Future of Gutenberg Phase 2 https://wordpress.org/about/roadmap/ https://github.com/WordPress/gutenberg/blob/master/docs/roadmap.md
  • 52. Contributing to gutenberg ▪ Guide https://developer.wordpress.org/block- editor/contributors/ 52
  • 53. Contributing to gutenberg ▪ Contribute to : ● Good first issue https://mkaz.blog/code/good-first-issue- on-gutenberg/ ● Documentation ● Design ● Adding Stories to StoryBook https://mkaz.blog/code/coding-a-storybook-story/ ● Testing ● Write Test Cases ● PR Reviews 53
  • 54. 54 THANKS! ANY QUESTIONS? You can find us on Twitter at: ▪ @imranhsayed ▪ @ajitbohra