Upgrade to Pro — share decks privately, control downloads, hide ads and more …

React for Gutenberg, WordPress & Beyond - WordCamp Omaha 2018

Zac Gordon
August 25, 2018

React for Gutenberg, WordPress & Beyond - WordCamp Omaha 2018

In this talk, educator Zac Gordon, talks about the migration of React into WordPress Core and what developers should know about it. We look at practical examples and things to know for using React with Gutenberg as well as in your own plugins and themes outside the editor. We will also discuss how React on the server, in native applications and in 360 or VR environments might play a role in time to come. If you don't know much React yet this will be a great introduction, and more experienced devs will get some ideas for interesting use cases for React and WordPress. Zac is the creator of two Gutenberg courses: Gutenberg Block Development w React and Theming with Gutenberg.

Zac Gordon

August 25, 2018
Tweet

More Decks by Zac Gordon

Other Decks in Technology

Transcript

  1. @zgordon javascriptforwp.com/omaha Getting React // Pure React import React from

    “react”; import ReactDOM from “react-dom”; // WordPress React const { createElement, render } = wp.element;
  2. @zgordon javascriptforwp.com/omaha Including React on the Frontend add_action( ‘wp_enqueue_scripts', 'my_enqueue_js'

    ); function my_enqueue_js() { wp_enqueue_script( 'needsreact', get_template_directory_uri() . '/js/needs-react.js', [ 'wp-element' ] ); }
  3. @zgordon javascriptforwp.com/omaha Non-JSX vs. JSX // Non JSX React.createElement("p", {

    className: "featured" }, "Hello"); // JSX <p className=“featured">Hello</p>
  4. @zgordon javascriptforwp.com/omaha Non-JSX vs. JSX // Non JSX React.createElement( "h1",

    { className: "welcome" }, React.createElement( "a", { className: "link" , href: “https://reactjs.org/“}, "Welcome!") ); // JSX <h1 class=“welcome”> <a class=“link” href=“https://reactjs.org/“>Welcome!</a> </h1>
  5. @zgordon javascriptforwp.com/omaha The data module is built upon and shares

    many of the same core principles of Redux, but shouldn’t be mistaken as merely Redux for WordPress, as it includes a few of its own distinguishing characteristics. wordpress.org/gutenberg/handbook/packages/packages-data/