SlideShare a Scribd company logo
POWER-UP YOUR
UI WITH WP-API
Steve Loar
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WHO AM I?
▸ Consultant - Working with Ruby on
Rails, WordPress, React, and more.
▸ Craftsman - Over 20 years of
crafting software solutions for large
and small companies.
▸ Cowboy - Riding horses and
competing in barrel racing and pole
bending.
▸ Connoisseur - Lover of fine coffee
and craft beer.
POWER-UP YOUR UI WITH WP-API AND REACT.JS
LETS TALK ABOUT WORDPRESS AND
REACT
“It’s too hard. I don’t want to!”
Source: http://www.laurenmarinigh.com/job-hunt-frustration/
POWER-UP YOUR UI WITH WP-API AND REACT.JS
BUT IT’S NOT HARD, IT’S REST-FUL
Source: Noon, rest from work by Van Gogh
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WHAT IS REST?
▸REST stands for Representational State Transfer.
▸It is an architectural style for networked applications using
HTTP.
▸It can perform all CRUD operations via GET, POST, PUT,
and DELETE.
▸Information is passed between clients and servers in either
XML or JSON formats.
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WHY
WOULD I
WANT TO
USE REST
IN
WORDPRES
S?
You can build interfaces for
both Web and Mobile, while
letting your site admins
keep the interface they
know and love.
Source: https://www.withfriendship.com/user/pintu/representational-state-transfer.php
Mobile
Web
POWER-UP YOUR UI WITH WP-API AND REACT.JS
INSTALL AND ACTIVATE THE
WORDPRESS REST API PLUGIN
Source: https://wordpress.org/plugins/
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WORDPRESS RESOURCES AVAILABLE
TO WP-API
▸Posts, Post revisions, Post types, Post statuses
▸Pages
▸Media
▸Comments
▸Users
▸Taxonomies, Categories, and Tags
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WE WILL ONLY LOOK AT THE POSTS
▸Make sure that your Permalink settings are set to “Post
name”.
▸Create and publish some posts.
▸You’re done. The plugin does the heavy lifting for you.
POWER-UP YOUR UI WITH WP-API AND REACT.JS
LET’S EXPLORE THE API WITH
POSTMAN
▸https://www.getpostman.com/
▸Postman is free, as a Chrome app or a Mac app.
▸It lets you interact with the WP-API plugin.
Source: https://www.getpostman.com/
POWER-UP YOUR UI WITH WP-API AND REACT.JS
THE POSTMAN INTERFACE
POWER-UP YOUR UI WITH WP-API AND REACT.JS
OUR PROJECT GOAL TODAY: A SIMPLE
QUOTES DISPLAY
LET’S
DABBLE
IN THE
DARK
ARTS
REACT, REDUX
AND, WEBPACK,
OH MY!
Source: The Wizard of Oz
POWER-UP YOUR UI WITH WP-API AND REACT.JS
OUR JOURNEY BEGINS WITH NPM
▸NPM is a package manager that will handle the install of the
JavaScript libraries that will power our project.
▸It comes with Node.js, which we also need.
▸Node.js should be installed via Homebrew on a Mac.
▸Homebrew needs Xcode and its command line tools to work.
▸Sounds complex, but as a developer, you probably know all
this already.
POWER-UP YOUR UI WITH WP-API AND REACT.JS
PROJECT SETUP
▸Open a terminal window
▸Navigate to the top level WordPress folder
▸Create a new folder named quotes, and navigate into it
▸Type ‘npm init’ and answer the questions it asks
▸You are now ready to install the packages to use in the
project
▸We will look at the main ones in this talk
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WEBPACK
▸A module bundler - think compiler. It’s main purpose is to
take your project assets and create a JavaScript file
▸To do this it can utilize the following
▸Plugins - to extend Webpack
▸Loaders - to process ES6, SASS, etc.
▸Code Splitting - to allow code loading on demand
▸Performance Optimization - caching and faster builds
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WEBPACK.CONFIG.JS
The entry file, the output
file, and some plugins
POWER-UP YOUR UI WITH WP-API AND REACT.JS
WEBPACK.CONFIG.JS
Loaders handling ES6
and SASS
POWER-UP YOUR UI WITH WP-API AND REACT.JS
REDUX
▸A state container - a single repository of all application data
▸Data never changes directly, but is re-created via Reducers.
▸Reducers are activated via ActionCreators
▸The idea is that data flows down to UI components, and
actions are sent up from UI components
POWER-UP YOUR UI WITH WP-API AND REACT.JS
CREATING A REDUX
STORE
POWER-UP YOUR UI WITH WP-API AND REACT.JS
ACTION CREATORS
POWER-UP YOUR UI WITH WP-API AND REACT.JS
QUOTE REDUCER
POWER-UP YOUR UI WITH WP-API AND REACT.JS
REACT-ROUTER
▸Allows URL routes to work in our app
POWER-UP YOUR UI WITH WP-API AND REACT.JS
REACT
▸Not a framework, just a library; so it needs the previous stuff
to do anything
▸Just the view part of the app
▸Code is broken down into JSX components which compile
into JavaScript
▸Uses a “Virtual DOM”; an in memory copy of the DOM
▸One way data flow; data in, actions out
POWER-UP YOUR UI WITH WP-API AND REACT.JS
APP.JS WIRES THINGS TOGETHER
POWER-UP YOUR UI WITH WP-API AND REACT.JS
MAIN.JS ACTS AS OUR PAGE LAYOUT
POWER-UP YOUR UI WITH WP-API AND REACT.JS
QUOTEGRID.JS IS OUR HOME VIEW
POWER-UP YOUR UI WITH WP-API AND REACT.JS
QUOTES.JS IS OUR SINGLE ITEM VIEW
POWER-UP YOUR UI WITH WP-API AND REACT.JS
OVERWHELMED YET? - WE ARE
ALMOST DONE
Source: http://www.sunsigns.org/9-reasons-why-you-may-feel-sleepy-at-work/
POWER-UP YOUR UI WITH WP-API AND REACT.JS
IMPORTANT THINGS I LEFT FOR YOU
▸Git - You need version control
▸Organization - Where to put what in your project
▸Testing - Automated testing with something like Mocha
▸Deployment - Making a production build with Webpack
▸Error handling - Gracefully catch errors and inform the user
▸Authentication - Logging people in and letting them do special things
like…
▸Other HTTP actions - We did not cover POST, PUT or DELETE
POWER-UP YOUR UI WITH WP-API AND REACT.JS
SUMMARY…
▸ WP-API plugin is easy to set up and allows new ways for you
to interact with WordPress
▸ React and it’s related technologies can be used in the creation
of plugins, themes, or totally separate interfaces. Go be
creative!
Source: http://chickensmoviereviews.blogspot.com/
It wasn’t too hard
POWER-UP YOUR UI WITH WP-API AND REACT.JS
STEVE LOAR CAN
BE FOUND…
▸ Twitter: @SteveLoar
▸ Email: sjl7909@gmail.com
▸ LinkedIn: www.linkedin.com/in/stevenloar
▸ GitHub: s-loar
▸ Slack: steve_loar
▸ Project: https://github.com/s-loar/react-
wordpress
▸ Slides:
https://speakerdeck.com/sloar/power-up-
your-ui-with-wp-api-and-react-dot-js

More Related Content

Similar to Steve_Loar_WordCamp-talk.pptx

Building cross platform web apps
Building cross platform web appsBuilding cross platform web apps
Building cross platform web apps
ITEM
 
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCampRichard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
BigDataCamp
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDQuest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDAndi Smith
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsNodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web Applications
Budh Ram Gurung
 
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fastHow Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
Atlassian
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014
Stéphane Bégaudeau
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web Apps
Rasheed Waraich
 
Building Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devicesBuilding Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devices
Windows Developer
 
Deploying PHP Applications to AWS Elastic Beanstalk
Deploying PHP Applications to AWS Elastic BeanstalkDeploying PHP Applications to AWS Elastic Beanstalk
Deploying PHP Applications to AWS Elastic Beanstalk
Boyd Hemphill
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
Carsten Sandtner
 
Progressive Web App Challenges
Progressive Web App ChallengesProgressive Web App Challenges
Progressive Web App Challenges
Jason Grigsby
 
DevOps For Small Teams
DevOps For Small TeamsDevOps For Small Teams
DevOps For Small Teams
Joe Ferguson
 
Exploring pwa for shopware
Exploring pwa for shopwareExploring pwa for shopware
Exploring pwa for shopware
Sander Mangel
 
Functional Web Development
Functional Web DevelopmentFunctional Web Development
Functional Web Development
FITC
 
Modern frontend workflow
Modern frontend workflowModern frontend workflow
Modern frontend workflowRevath S Kumar
 
Offline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and ReactOffline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and React
Ilia Idakiev
 
Learn react-js
Learn react-jsLearn react-js
Essentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with WebpackEssentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with Webpack
Khaled Al-Ansari
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
CodeValue
 
WordPress automation and CI
WordPress automation and CIWordPress automation and CI
WordPress automation and CI
Ran Bar-Zik
 

Similar to Steve_Loar_WordCamp-talk.pptx (20)

Building cross platform web apps
Building cross platform web appsBuilding cross platform web apps
Building cross platform web apps
 
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCampRichard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDQuest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFRED
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web ApplicationsNodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web Applications
 
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fastHow Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014
 
Architecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web AppsArchitecture & Workflow of Modern Web Apps
Architecture & Workflow of Modern Web Apps
 
Building Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devicesBuilding Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devices
 
Deploying PHP Applications to AWS Elastic Beanstalk
Deploying PHP Applications to AWS Elastic BeanstalkDeploying PHP Applications to AWS Elastic Beanstalk
Deploying PHP Applications to AWS Elastic Beanstalk
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
 
Progressive Web App Challenges
Progressive Web App ChallengesProgressive Web App Challenges
Progressive Web App Challenges
 
DevOps For Small Teams
DevOps For Small TeamsDevOps For Small Teams
DevOps For Small Teams
 
Exploring pwa for shopware
Exploring pwa for shopwareExploring pwa for shopware
Exploring pwa for shopware
 
Functional Web Development
Functional Web DevelopmentFunctional Web Development
Functional Web Development
 
Modern frontend workflow
Modern frontend workflowModern frontend workflow
Modern frontend workflow
 
Offline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and ReactOffline progressive web apps with NodeJS and React
Offline progressive web apps with NodeJS and React
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Essentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with WebpackEssentials in JavaScript App Bundling with Webpack
Essentials in JavaScript App Bundling with Webpack
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
 
WordPress automation and CI
WordPress automation and CIWordPress automation and CI
WordPress automation and CI
 

Recently uploaded

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 

Recently uploaded (20)

Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 

Steve_Loar_WordCamp-talk.pptx

  • 1. POWER-UP YOUR UI WITH WP-API Steve Loar
  • 2. POWER-UP YOUR UI WITH WP-API AND REACT.JS WHO AM I? ▸ Consultant - Working with Ruby on Rails, WordPress, React, and more. ▸ Craftsman - Over 20 years of crafting software solutions for large and small companies. ▸ Cowboy - Riding horses and competing in barrel racing and pole bending. ▸ Connoisseur - Lover of fine coffee and craft beer.
  • 3. POWER-UP YOUR UI WITH WP-API AND REACT.JS LETS TALK ABOUT WORDPRESS AND REACT “It’s too hard. I don’t want to!” Source: http://www.laurenmarinigh.com/job-hunt-frustration/
  • 4. POWER-UP YOUR UI WITH WP-API AND REACT.JS BUT IT’S NOT HARD, IT’S REST-FUL Source: Noon, rest from work by Van Gogh
  • 5. POWER-UP YOUR UI WITH WP-API AND REACT.JS WHAT IS REST? ▸REST stands for Representational State Transfer. ▸It is an architectural style for networked applications using HTTP. ▸It can perform all CRUD operations via GET, POST, PUT, and DELETE. ▸Information is passed between clients and servers in either XML or JSON formats.
  • 6. POWER-UP YOUR UI WITH WP-API AND REACT.JS WHY WOULD I WANT TO USE REST IN WORDPRES S? You can build interfaces for both Web and Mobile, while letting your site admins keep the interface they know and love. Source: https://www.withfriendship.com/user/pintu/representational-state-transfer.php Mobile Web
  • 7. POWER-UP YOUR UI WITH WP-API AND REACT.JS INSTALL AND ACTIVATE THE WORDPRESS REST API PLUGIN Source: https://wordpress.org/plugins/
  • 8. POWER-UP YOUR UI WITH WP-API AND REACT.JS WORDPRESS RESOURCES AVAILABLE TO WP-API ▸Posts, Post revisions, Post types, Post statuses ▸Pages ▸Media ▸Comments ▸Users ▸Taxonomies, Categories, and Tags
  • 9. POWER-UP YOUR UI WITH WP-API AND REACT.JS WE WILL ONLY LOOK AT THE POSTS ▸Make sure that your Permalink settings are set to “Post name”. ▸Create and publish some posts. ▸You’re done. The plugin does the heavy lifting for you.
  • 10. POWER-UP YOUR UI WITH WP-API AND REACT.JS LET’S EXPLORE THE API WITH POSTMAN ▸https://www.getpostman.com/ ▸Postman is free, as a Chrome app or a Mac app. ▸It lets you interact with the WP-API plugin. Source: https://www.getpostman.com/
  • 11. POWER-UP YOUR UI WITH WP-API AND REACT.JS THE POSTMAN INTERFACE
  • 12. POWER-UP YOUR UI WITH WP-API AND REACT.JS OUR PROJECT GOAL TODAY: A SIMPLE QUOTES DISPLAY
  • 13. LET’S DABBLE IN THE DARK ARTS REACT, REDUX AND, WEBPACK, OH MY! Source: The Wizard of Oz
  • 14. POWER-UP YOUR UI WITH WP-API AND REACT.JS OUR JOURNEY BEGINS WITH NPM ▸NPM is a package manager that will handle the install of the JavaScript libraries that will power our project. ▸It comes with Node.js, which we also need. ▸Node.js should be installed via Homebrew on a Mac. ▸Homebrew needs Xcode and its command line tools to work. ▸Sounds complex, but as a developer, you probably know all this already.
  • 15. POWER-UP YOUR UI WITH WP-API AND REACT.JS PROJECT SETUP ▸Open a terminal window ▸Navigate to the top level WordPress folder ▸Create a new folder named quotes, and navigate into it ▸Type ‘npm init’ and answer the questions it asks ▸You are now ready to install the packages to use in the project ▸We will look at the main ones in this talk
  • 16. POWER-UP YOUR UI WITH WP-API AND REACT.JS WEBPACK ▸A module bundler - think compiler. It’s main purpose is to take your project assets and create a JavaScript file ▸To do this it can utilize the following ▸Plugins - to extend Webpack ▸Loaders - to process ES6, SASS, etc. ▸Code Splitting - to allow code loading on demand ▸Performance Optimization - caching and faster builds
  • 17. POWER-UP YOUR UI WITH WP-API AND REACT.JS WEBPACK.CONFIG.JS The entry file, the output file, and some plugins
  • 18. POWER-UP YOUR UI WITH WP-API AND REACT.JS WEBPACK.CONFIG.JS Loaders handling ES6 and SASS
  • 19. POWER-UP YOUR UI WITH WP-API AND REACT.JS REDUX ▸A state container - a single repository of all application data ▸Data never changes directly, but is re-created via Reducers. ▸Reducers are activated via ActionCreators ▸The idea is that data flows down to UI components, and actions are sent up from UI components
  • 20. POWER-UP YOUR UI WITH WP-API AND REACT.JS CREATING A REDUX STORE
  • 21. POWER-UP YOUR UI WITH WP-API AND REACT.JS ACTION CREATORS
  • 22. POWER-UP YOUR UI WITH WP-API AND REACT.JS QUOTE REDUCER
  • 23. POWER-UP YOUR UI WITH WP-API AND REACT.JS REACT-ROUTER ▸Allows URL routes to work in our app
  • 24. POWER-UP YOUR UI WITH WP-API AND REACT.JS REACT ▸Not a framework, just a library; so it needs the previous stuff to do anything ▸Just the view part of the app ▸Code is broken down into JSX components which compile into JavaScript ▸Uses a “Virtual DOM”; an in memory copy of the DOM ▸One way data flow; data in, actions out
  • 25. POWER-UP YOUR UI WITH WP-API AND REACT.JS APP.JS WIRES THINGS TOGETHER
  • 26. POWER-UP YOUR UI WITH WP-API AND REACT.JS MAIN.JS ACTS AS OUR PAGE LAYOUT
  • 27. POWER-UP YOUR UI WITH WP-API AND REACT.JS QUOTEGRID.JS IS OUR HOME VIEW
  • 28. POWER-UP YOUR UI WITH WP-API AND REACT.JS QUOTES.JS IS OUR SINGLE ITEM VIEW
  • 29. POWER-UP YOUR UI WITH WP-API AND REACT.JS OVERWHELMED YET? - WE ARE ALMOST DONE Source: http://www.sunsigns.org/9-reasons-why-you-may-feel-sleepy-at-work/
  • 30. POWER-UP YOUR UI WITH WP-API AND REACT.JS IMPORTANT THINGS I LEFT FOR YOU ▸Git - You need version control ▸Organization - Where to put what in your project ▸Testing - Automated testing with something like Mocha ▸Deployment - Making a production build with Webpack ▸Error handling - Gracefully catch errors and inform the user ▸Authentication - Logging people in and letting them do special things like… ▸Other HTTP actions - We did not cover POST, PUT or DELETE
  • 31. POWER-UP YOUR UI WITH WP-API AND REACT.JS SUMMARY… ▸ WP-API plugin is easy to set up and allows new ways for you to interact with WordPress ▸ React and it’s related technologies can be used in the creation of plugins, themes, or totally separate interfaces. Go be creative! Source: http://chickensmoviereviews.blogspot.com/ It wasn’t too hard
  • 32. POWER-UP YOUR UI WITH WP-API AND REACT.JS STEVE LOAR CAN BE FOUND… ▸ Twitter: @SteveLoar ▸ Email: sjl7909@gmail.com ▸ LinkedIn: www.linkedin.com/in/stevenloar ▸ GitHub: s-loar ▸ Slack: steve_loar ▸ Project: https://github.com/s-loar/react- wordpress ▸ Slides: https://speakerdeck.com/sloar/power-up- your-ui-with-wp-api-and-react-dot-js