<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: J.C. Hiatt</title>
    <description>The latest articles on DEV Community by J.C. Hiatt (@jchiatt).</description>
    <link>https://dev.to/jchiatt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3098%2F84418abd-df9b-466d-840a-b8023786debc.jpg</url>
      <title>DEV Community: J.C. Hiatt</title>
      <link>https://dev.to/jchiatt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jchiatt"/>
    <language>en</language>
    <item>
      <title>Let's re-implement JavaScript's Array.map method!</title>
      <dc:creator>J.C. Hiatt</dc:creator>
      <pubDate>Tue, 02 Jul 2019 15:04:42 +0000</pubDate>
      <link>https://dev.to/jchiatt/let-s-re-implement-javascript-s-array-map-method-2cnd</link>
      <guid>https://dev.to/jchiatt/let-s-re-implement-javascript-s-array-map-method-2cnd</guid>
      <description>&lt;p&gt;I've been posting &lt;a href="https://twitter.com/hashtag/JCsJSTips"&gt;daily JavaScript challenges on Twitter&lt;/a&gt; lately, and today's challenge involves &lt;a href="https://twitter.com/jchiatt/status/1146034617646047233"&gt;re-implementing Array.map&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is certainly not the only solution for this, but here's my stab at it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does Array.map do?
&lt;/h2&gt;

&lt;p&gt;Full details can be found on the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map"&gt;MDN docs&lt;/a&gt;, but here's the gist of things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;.map lives on the Array prototype&lt;/li&gt;
&lt;li&gt;It returns a new Array from after calling a callback function on every element of the array on which you call it.&lt;/li&gt;
&lt;li&gt;The callback function has 3 arguments, the last two of which are optional: the current item, the current index, and the original array you called .map on.&lt;/li&gt;
&lt;li&gt;You can optionally pass in a second argument after the callback, which will be the &lt;code&gt;this&lt;/code&gt; context to call the callback with. If you don't pass in a &lt;code&gt;this&lt;/code&gt; context, the callback will be called with &lt;code&gt;undefined&lt;/code&gt; as the &lt;code&gt;this&lt;/code&gt; context.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Example of Array.map
&lt;/h2&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;exercises&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bench Press&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Svend Press&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Chest Flyes&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Kettlebell Swing&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;40 Yard Sprint&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;exercises&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mapped &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;;
})

// returns:
[ 'mapped Bench Press',
  'mapped Svend Press',
  'mapped Chest Flyes',
  'mapped Kettlebell Swing',
  'mapped 40 Yard Sprint' ]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Re-implementing the method
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Set up our function with the arguments we know it will take.
&lt;/h3&gt;

&lt;p&gt;We know map accepts a &lt;code&gt;callback&lt;/code&gt; and a &lt;code&gt;this&lt;/code&gt; context. We also know that the &lt;code&gt;this&lt;/code&gt; context will be set to &lt;code&gt;undefined&lt;/code&gt; if one is not passed in, so we'll set a default value on that argument.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;thisArg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// more code will go here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  2. Exit early if there's a problem and give error messages.
&lt;/h3&gt;

&lt;p&gt;First check is to make sure &lt;code&gt;newMap&lt;/code&gt; was called on an array.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;thisArg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Ensure it called on an array.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Must be called on an array&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Next, make sure a callback was supplied since it is required.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;thisArg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Ensure it called on an array.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Must be called on an array&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Make sure a callback was supplied.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;undefined is not a function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Lastly, make sure that &lt;em&gt;if&lt;/em&gt; a callback &lt;em&gt;was&lt;/em&gt; supplied, it is a function.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;thisArg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Ensure it called on an array.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Must be called on an array&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Ensure a callback was supplied.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;undefined is not a function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Ensure the supplied callback is a function.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; is not a function&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  3. Execute the callback for each item in the array.
&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;thisArg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Ensure it called on an array.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Must be called on an array&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Ensure a callback was supplied.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;undefined is not a function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Ensure the supplied callback is a function.&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;function&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;TypeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; is not a function&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/**
  * Make a copy of the original array, just in case the callback 
  * does any mutations on the current value.
  */&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Initialize a new array to build and return.&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;newArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="c1"&gt;// Loop through the length of the original array.&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/**
    * Execute the callback with `thisArg` as the `this` context.
    * Callback is executed with 3 arguments:
    * self[i] is the current value
    * i is the current index
    * this is the original array
    */&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;thisArg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Add the result of the callback to the new array.&lt;/span&gt;
    &lt;span class="nx"&gt;newArray&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Return the new array.&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;newArray&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Testing our new method.
&lt;/h2&gt;

&lt;p&gt;We can attach our new method to the &lt;code&gt;Array&lt;/code&gt; prototype and test it out like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;exercises&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`new &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;endraw&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;// Returns the same result as Array.map&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;new Bench Press&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;new Svend Press&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;new Chest Flyes&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;new Kettlebell Swing&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;new 40 Yard Sprint&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




&lt;p&gt;Interested in more tips and challenges? &lt;a href="https://twitter.com/jchiatt"&gt;Follow me on Twitter&lt;/a&gt; and also check out my &lt;a href="https://repl.it/@jchiatt/JCs-JS-Tips"&gt;collection of previous tips and challenges&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>arrays</category>
      <category>map</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Planning a JavaScript conference in only 10 weeks — Part 3</title>
      <dc:creator>J.C. Hiatt</dc:creator>
      <pubDate>Tue, 26 Mar 2019 14:08:31 +0000</pubDate>
      <link>https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks--part-3-49f5</link>
      <guid>https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks--part-3-49f5</guid>
      <description>&lt;p&gt;In case you missed it, this post is part of a series of updates I've been giving about &lt;a href="https://magnoliajs.com"&gt;MagnoliaJS&lt;/a&gt;, the conference I'm planning in only 10 weeks.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks--part-2-5b5n"&gt;read last week's update here&lt;/a&gt;, and you can &lt;a href="https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks-411i"&gt;read the backstory here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;Here's how last week went!&lt;/p&gt;

&lt;p&gt;I was able to secure a couple of additional sponsors. To date, our sponsors are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://infinite.red"&gt;Infinite Red&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mscoding.org/"&gt;Mississippi Coding Academies&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://echobind.com"&gt;Echobind&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.devrelate.io/"&gt;DevRelate.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.smartzweb.com/"&gt;Smartz Web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.msegov.com/Pages/default.aspx"&gt;Mississippi Interactive&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's still a few companies out there I've spoken with — hoping they come through! If you would like to sponsor this awesome conference, check out &lt;a href="https://magnoliajs.com/sponsor"&gt;https://magnoliajs.com/sponsor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also went full on open source with the planning — moving all my high-level todos to &lt;a href="https://github.com/jchiatt/magnoliajs.com/issues"&gt;the Github repo&lt;/a&gt;. HUGE shoutouts to Levi Robertson for &lt;a href="https://github.com/jchiatt/magnoliajs.com/pull/14"&gt;helping get the speakers page on the website&lt;/a&gt;, Natalie Thomas for &lt;a href="https://twitter.com/jchiatt/status/1109080253908037632"&gt;designing some awesome t-shirts and signage&lt;/a&gt;, and Jalen Davenport for &lt;a href="https://twitter.com/jchiatt/status/1110540029720477697"&gt;volunteering to design speaker cards for Twitter&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;I made some customizations to our &lt;a href="https://ti.to/magnoliajs/magnoliajs-2019"&gt;event page on Tito&lt;/a&gt; so it was clearer who the speaker lineup was, and I also announced workshops!&lt;/p&gt;

&lt;p&gt;I finalized the contract with the photographer and also booked the emcee for our event, Kenneth LaFrance, who came highly recommended.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.papercall.io/events/2130"&gt;CFP&lt;/a&gt; closed, and now there's &lt;strong&gt;68 submissions&lt;/strong&gt; for me to go through! Not bad considering it was only open a couple of weeks and nobody had heard of this conference before!&lt;/p&gt;

&lt;p&gt;Here's some stats from the past 3 weeks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Talk submissions: 68&lt;/li&gt;
&lt;li&gt;Tickets sold: 50 (more expected this week when I start promoting more)&lt;/li&gt;
&lt;li&gt;Money raised: $10,500&lt;/li&gt;
&lt;li&gt;Twitter followers: 153&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Up next
&lt;/h2&gt;

&lt;p&gt;Check out the &lt;a href="https://github.com/jchiatt/magnoliajs.com/issues"&gt;Github repo&lt;/a&gt; to see what's up next!&lt;/p&gt;

&lt;h2&gt;
  
  
  How you can help
&lt;/h2&gt;

&lt;p&gt;The best way to help is by &lt;a href="https://ti.to/magnoliajs/magnoliajs-2019"&gt;buying a ticket&lt;/a&gt;! &lt;strong&gt;Early Bird is available for a few more days!&lt;/strong&gt; Even if you can't make it, you can buy a ticket for someone who wants to attend but can't afford it. Just DM me on Twitter for more info!&lt;/p&gt;

&lt;p&gt;The next best thing is helping to spread the word! Follow &lt;a href="https://twitter.com/magnoliajsconf"&gt;@MagnoliaJSconf&lt;/a&gt; on Twitter and share anything you see — that's sooo helpful!&lt;/p&gt;

&lt;p&gt;👋&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>conferences</category>
      <category>speaking</category>
      <category>devrel</category>
    </item>
    <item>
      <title>Planning a JavaScript conference in only 10 weeks — Part 2</title>
      <dc:creator>J.C. Hiatt</dc:creator>
      <pubDate>Mon, 18 Mar 2019 22:42:41 +0000</pubDate>
      <link>https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks--part-2-5b5n</link>
      <guid>https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks--part-2-5b5n</guid>
      <description>&lt;p&gt;Last week, I published the backstory of &lt;a href="https://magnoliajs.com"&gt;MagnoliaJS&lt;/a&gt;, as well as what I, along with a ton of support from the community, had been able to accomplish in my first week of serious planning.&lt;/p&gt;

&lt;p&gt;Well, here's an update of how last week went!&lt;/p&gt;

&lt;p&gt;First off, I was able to raise another ~$2,000. I still &lt;em&gt;must&lt;/em&gt; raise at least another $10,000 within the next couple of weeks — reach out if you'd like to &lt;a href="https://magnoliajs.com/sponsor"&gt;sponsor&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Thanks so much to &lt;a href="https://echobind.com/"&gt;Echobind&lt;/a&gt;, &lt;a href="https://devrelate.io"&gt;DevRelate&lt;/a&gt;, and &lt;a href="https://infinite.red"&gt;Infinite Red&lt;/a&gt; for sponsoring!&lt;/p&gt;

&lt;p&gt;I finally got a bank account open, so we actually can accept money now.&lt;/p&gt;

&lt;p&gt;I ran a giveaway (sponsored by &lt;a href="https://infinite.red"&gt;Infinite Red&lt;/a&gt;) to &lt;a href="https://infinite.red/ChainReactConf"&gt;ChainReactConf&lt;/a&gt;. Congrats again to Dallas for winning! I have one more ticket to giveaway — keep an eye on &lt;a href="https://twitter.com/MagnoliaJSconf"&gt;our Twitter&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Next, I confirmed all Main Stage speakers! We have a really amazing lineup. I'm blown away — if you would have asked me 3 weeks ago if our lineup would be &lt;em&gt;this&lt;/em&gt; good, I would have say definitely not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Laurie Voss (&lt;a href="https://twitter.com/seldo"&gt;@seldo&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Ken Wheeler (&lt;a href="https://twitter.com/ken_wheeler"&gt;@ken_wheeler&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Jay Phelps (&lt;a href="https://twitter.com/_jayphelps"&gt;@_jayphelps&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tae'lur Alexis (&lt;a href="https://twitter.com/TaelurAlexis"&gt;@taeluralexis&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Nader Dabit (&lt;a href="https://twitter.com/dabit3"&gt;@dabit3&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Joe Previte (&lt;a href="https://twitter.com/jsjoeio"&gt;@jsjoeio&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Gant Laborde (&lt;a href="https://twitter.com/GantLaborde"&gt;@gantlaborde&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Kurt Kemple (&lt;a href="https://twitter.com/kurtiskemple"&gt;@kurtiskemple&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Sia Karamalegos (&lt;a href="https://twitter.com/thegreengreek"&gt;@thegreengeek&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Blake Watson (&lt;a href="https://twitter.com/blakewatson"&gt;@blakewatson&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lastly, I was able to launch &lt;a href="https://ti.to/magnoliajs/magnoliajs-2019"&gt;Early Bird ticket sales&lt;/a&gt; using &lt;a href="https://ti.to"&gt;Tito&lt;/a&gt;! The page is a bit incomplete (I have to make some customizations tonight), but it's functional and we've sold our first tickets! I highly recommend Tito — it took me ~20 minutes from start to finish to be ready to accept money and sale tickets!&lt;/p&gt;

&lt;h2&gt;
  
  
  Up Next
&lt;/h2&gt;

&lt;h3&gt;
  
  
  High Priority
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Get more sponsors&lt;/li&gt;
&lt;li&gt;Add speakers to website (probably missing ticket sales because of this right now)&lt;/li&gt;
&lt;li&gt;Close &lt;a href="https://magnoliajs.com/speak"&gt;CFP&lt;/a&gt; on Friday and start selecting the rest of the speakers&lt;/li&gt;
&lt;li&gt;Customize event page on Tito&lt;/li&gt;
&lt;li&gt;Contact emcee who was recommended to me&lt;/li&gt;
&lt;li&gt;Finalize and publish all workshops&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Regular Priority
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Contact meetup organizers in surrounding states and offer coupons, specifically:

&lt;ul&gt;
&lt;li&gt;Atlanta&lt;/li&gt;
&lt;li&gt;Birmingham&lt;/li&gt;
&lt;li&gt;Little Rock&lt;/li&gt;
&lt;li&gt;Memphis&lt;/li&gt;
&lt;li&gt;Nashville&lt;/li&gt;
&lt;li&gt;New Orleans&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Finalize contract with photographer&lt;/li&gt;
&lt;li&gt;Generate speaker cards for Twitter using &lt;a href="https://github.com/airbnb/react-sketchapp/blob/master/examples/profile-cards/src/main.js"&gt;React-Sketchapp&lt;/a&gt; (thanks a ton to &lt;a href="https://twitter.com/peterpme"&gt;Peter Piekarczyk&lt;/a&gt; for showing me how I could use this to easily generate speaker card PNGs for Twitter!)&lt;/li&gt;
&lt;li&gt;Conduct another giveaway for ChainReact Conf&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any tips at all or would like to help out, please reach out!&lt;/p&gt;

&lt;p&gt;And if you haven't already, go &lt;a href="https://ti.to/magnoliajs/magnoliajs-2019"&gt;purchase an Early Bird ticket&lt;/a&gt; and come hang with us on April 18!&lt;/p&gt;

</description>
      <category>conferences</category>
      <category>planning</category>
      <category>events</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Planning a JavaScript conference in only 10 weeks</title>
      <dc:creator>J.C. Hiatt</dc:creator>
      <pubDate>Mon, 11 Mar 2019 16:06:58 +0000</pubDate>
      <link>https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks-411i</link>
      <guid>https://dev.to/jchiatt/planning-a-javascript-conference-in-only-10-weeks-411i</guid>
      <description>&lt;p&gt;I love going to conferences. The energy is always high, I always learn something (usually multiple things), and I always leave motivated to go Crush It™️.&lt;/p&gt;

&lt;p&gt;Conferences I've been to are usually pretty big — there's lots of great speakers, huge sponsor booths, great food, awesome after parties (looking at you, &lt;a href="https://connect.tech" rel="noopener noreferrer"&gt;Connect.Tech&lt;/a&gt;!!), and of course, awesome swag 😎.&lt;/p&gt;

&lt;p&gt;There's usually a nice venue, with hundreds of people, listening to lots of speakers from all over the world, sponsored by [usually] some pretty big companies.   That's a lot of things to coordinate! How long do you think it takes to plan one of those conferences?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I'm genuinely asking.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm asking because earlier this year I was approached by the Mayor of Jackson, Mississippi (my homeland) to plan a developer conference. And not just any conference — Mississippi's &lt;strong&gt;first-ever&lt;/strong&gt; developer conference. See, he's throwing a large general tech conference called Tech JXN April 16 and 17 because he wants to help promote Jackson as a place ripe for technological innovation — he wants to put us on the map. And he wanted a developer conference the next day, April 18th.&lt;/p&gt;

&lt;p&gt;About 12 weeks away.&lt;/p&gt;

&lt;p&gt;And I said yes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;p&gt;Mississippi lags behind in tech. A lot. And this is for a whole host of reasons, a few of which include lack of technologically innovative companies, lack of access to capital, lack of access to a large population with early adopter traits, and lack of talent.&lt;/p&gt;

&lt;p&gt;Yes, there are developers here. But most don't stay (and &lt;a href="http://innovatems.uberflip.com/youtube-all-videos/big-ideas-tim-mask-incentives-to-fight-brain-drain-in-mississippi" rel="noopener noreferrer"&gt;here's a great talk&lt;/a&gt; by my friend Tim Mask on this problem — something he refers to as "Brain Drain"). &lt;/p&gt;

&lt;p&gt;I actually organize the &lt;a href="https://www.meetup.com/Jackson-Area-Web-And-App-Developers/" rel="noopener noreferrer"&gt;only developer meetup&lt;/a&gt; in central Mississippi (and one of less than 5-ish in the state). The need for developers here is real, y'all.&lt;/p&gt;

&lt;p&gt;It's simply a different world here than a lot of the tech hubs out there. While the Internet has created an even playing field for information, most of the opportunity has been centralized to large cities.&lt;/p&gt;

&lt;p&gt;And that's fine. I'm not complaining. That's honestly to be expected in this early stage of the digital age we are still in. But what it &lt;em&gt;does&lt;/em&gt; mean is that somebody (people like Tim and I) has to work really hard to bring innovation here.&lt;/p&gt;

&lt;h2&gt;
  
  
  How?
&lt;/h2&gt;

&lt;p&gt;Okay, so back to the mayor. He knows that we need companies, capital, and talent to push us forward. Kudos to him for seeing that!&lt;/p&gt;

&lt;p&gt;His office offered me the &lt;a href="https://t.co/jgWKgOhPO4" rel="noopener noreferrer"&gt;Jackson Convention Center&lt;/a&gt; as well as a small seed fund and help with logistics and printing. I need to take a pause here to say &lt;strong&gt;THANK YOU&lt;/strong&gt; to the City of Jackson for giving me the initial momentum here and helping in such big ways!&lt;/p&gt;

&lt;p&gt;By the time I said yes and was able to work out a few upfront hurdles I perceived, we were 10 weeks out. You may think I'm crazy for saying yes. How will I get speakers and sponsors so quickly? Will sponsors even be able to cut a check before the event? How will I get the word out?&lt;/p&gt;

&lt;p&gt;Before I go into the specifics of what I've been doing, let me say upfront: &lt;strong&gt;I have never done this before.&lt;/strong&gt; I've attended conferences, but never planned them.&lt;/p&gt;

&lt;p&gt;Okay, so the first thing I did was recruit some help. I knew assembling a committee and divvying up tasks could take a while and burn through precious time, so I opted to hire one friend (an event planner with no tech background) to handle the logistics, and I would handle everything else.&lt;/p&gt;

&lt;p&gt;But obviously I still needed others' advice and opinions. After all, I have little to no idea about what I'm doing here.&lt;/p&gt;

&lt;p&gt;So I took to Twitter, where all great conversations happen™️. I decided to "plan in public," (inspired by the &lt;a href="https://gist.github.com/sw-yx/9720bd4a30606ca3ffb8d407113c0fe5" rel="noopener noreferrer"&gt;brilliant essay series&lt;/a&gt; by &lt;a href="https://twitter.com/swyx" rel="noopener noreferrer"&gt;@swyx&lt;/a&gt; and the community really showed up!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/jchiatt/status/1102361863067705344" rel="noopener noreferrer"&gt;Here's the original thread.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've gotten a lot of great support from the dev community so far. People have DM'd me about sponsoring, volunteering, and speaking, and many have helped me spread the word! A special shoutout to &lt;a href="https://twitter.com/GantLaborde" rel="noopener noreferrer"&gt;Gant Laborde&lt;/a&gt; and &lt;a href="https://twitter.com/alwayshiccups" rel="noopener noreferrer"&gt;Shawni Danner&lt;/a&gt; of Infinite Red for hopping on a call and giving me a ton of advice from their experience planning &lt;a href="https://twitter.com/chainreactconf" rel="noopener noreferrer"&gt;ChainReactConf&lt;/a&gt;. Oh, and they hooked me up with a couple of tickets to giveaway to ChainReact in order to promote my conference! I'm incredibly grateful!&lt;/p&gt;

&lt;p&gt;So far, I've had the community help decide what to call it, what the topic(s) should be, who should speak, and more! I was able to fork a great repo from &lt;a href="https://github.com/JavaScriptandFriends/javascriptandfriends.com" rel="noopener noreferrer"&gt;JavaScript &amp;amp; Friends Conference&lt;/a&gt; to spin up a website within a few hours. A logo was created by a coworker of mine, &lt;a href="https://twitter.com/ry_stephen" rel="noopener noreferrer"&gt;Ryan Stephen&lt;/a&gt;. I've confirmed 3 Main Stage speakers (and a few others are pending!). I've decided on a theme for the conference ("how coding can change your life"). I've launched the CFP. I've raised $8,000 of our $40,000 goal. I got a local entrepreneur to give us a bridge loan of up to $10,000 (if needed) in order to front costs while we wait for certain sponsor checks to come in (many larger companies we are approaching cannot cut checks for 60-90 days and I definitely don't have the money myself to pay for everything upfront).&lt;/p&gt;

&lt;p&gt;Oh, and all of this happened in the past 8 days. It's &lt;em&gt;AMAZING&lt;/em&gt; what can happen when the community comes together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fagr83bu98dqr3d4p56dg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fagr83bu98dqr3d4p56dg.png" alt="MagnoliaJS Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;Our CFP is open until March 22 (&lt;a href="https://magnoliajs.com/speak" rel="noopener noreferrer"&gt;go here if you want to speak!&lt;/a&gt;). After that, we'll announce all the speakers on the website. We are &lt;strong&gt;prioritizing first-time speakers&lt;/strong&gt; (though anyone can submit!) — it's my first time to plan a conference. &lt;strong&gt;Let it be your first time to speak.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Right now &lt;strong&gt;we need sponsors very badly&lt;/strong&gt;, so I'm solely focused this week on raising more funds. We have sponsorship levels starting at $100, so if you are feeling generous, please consider sponsoring or asking your boss if your company could sponsor! All sponsorship details are available &lt;a href="https://magnoliajs.com/sponsor" rel="noopener noreferrer"&gt;on our website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I'm also working on getting things ready to go live with Early Bird sales this Friday, the 15th.&lt;/p&gt;

&lt;p&gt;I just had a call with Natalie Thomas, a local designer who has volunteered to help out with t-shirts, signage, etc.&lt;/p&gt;

&lt;p&gt;There's a ton more to do — that's just what we're working on this coming week. I'm expecting there may be another follow-up post to this one soon. 🤓&lt;/p&gt;

&lt;p&gt;This conference means so much to me. It will be the first of many conferences in Mississippi. It will be a positive Mississippi experience to visitors who join us from other places. It will be a shining beacon for what can be achieved when the community comes together. It will be the beginning of greater things for tech in mS&lt;/p&gt;

&lt;p&gt;We are just under 6 weeks out. Can a respectable conference be planned in such a short amount of time? Well, I don't know. We'll find out together soon enough.&lt;/p&gt;

</description>
      <category>conferences</category>
      <category>planning</category>
      <category>events</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Headless WordPress with React</title>
      <dc:creator>J.C. Hiatt</dc:creator>
      <pubDate>Mon, 13 Feb 2017 19:01:38 +0000</pubDate>
      <link>https://dev.to/jchiatt/headless-wordpress-with-react</link>
      <guid>https://dev.to/jchiatt/headless-wordpress-with-react</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqrmn49y2ub629ekjxkp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqrmn49y2ub629ekjxkp.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  An intro to building decoupled WordPress-powered websites using the WordPress REST API and Create ReactÂ App
&lt;/h2&gt;

&lt;p&gt;In recent months, I've taken a big interest in the WordPress REST API (hereto referred to as the WP-API) and React. I've been writing an introductory series to the WP-API, but decided to break for a more full-length, detailed post.&lt;/p&gt;

&lt;p&gt;This post will outline how to get started building decoupled (or “headless”) WordPress web applications with Create React App and the WP-API. While this post is going to focus on React for the frontend, some of the general concepts still apply if you want to build your frontend with something else such as Angular, Rx, Ember, or Vue.&lt;/p&gt;

&lt;p&gt;And you don't have to stop with web applications. You can use the WP-API to power not only web applications, but also mobile apps, gaming console apps, and more, simultaneously.&lt;/p&gt;

&lt;p&gt;Before getting started, feel free to &lt;a href="https://github.com/jchiatt/headless-wp" rel="noopener noreferrer"&gt;clone the repository for this demo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why WordPress?
&lt;/h3&gt;

&lt;p&gt;Your first question may be “why should I care that WordPress has an API?” I've already written about this a bit &lt;a href="https://notes.builtbygood.co/getting-started-with-the-wordpress-rest-api-part-1-intro-66cf14d3ebb1#.awujhv69a" rel="noopener noreferrer"&gt;in another post&lt;/a&gt;, but if you aren't up for opening another tab, here are a few highlights:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;As of November, &lt;a href="https://wptavern.com/wordpress-passes-27-market-share-banks-on-customizer-for-continued-success" rel="noopener noreferrer"&gt;WordPress now powers over 27% of the web&lt;/a&gt;&lt;/strong&gt;. And as of version 4.7, released just a couple of months ago, all the content endpoints for the WP-API are now included in WordPress core, so millions of new APIs just went online.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WordPress is super user-friendly.&lt;/strong&gt; This may be the single biggest reason why WordPress has seen such widespread adoption. It allows anyone, even non-technical people, to create and edit a website. There is no other tool with the same amount of features and support in existence that's as empowering as WordPress.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WordPress is a powerful content management platform&lt;/strong&gt;. It's a common misconception among some developers who have never used WordPress (or who haven't used it in a long time) that WordPress is merely for blogging. While it's great for blogging, it's actually great for effectively managing custom content via &lt;a href="https://codex.wordpress.org/Post_Types#Custom_Post_Types" rel="noopener noreferrer"&gt;Custom Post Types&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why Create ReactÂ App?
&lt;/h3&gt;

&lt;p&gt;Unless you've been living under a rock in the web development world, you've undoubtedly heard of &lt;a href="https://facebook.github.io/react/" rel="noopener noreferrer"&gt;React&lt;/a&gt; by now. Going into the background of React is beyond the scope of this article, but I do want to introduce you to &lt;a href="https://github.com/facebookincubator/create-react-app" rel="noopener noreferrer"&gt;Create React App&lt;/a&gt;, the easiest way to get started with React.&lt;/p&gt;

&lt;p&gt;Getting started with React itself is pretty easy. You can drop React and ReactDOM into your application today:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://unpkg.com/react@15/dist/react.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="https://unpkg.com/react-dom@15/dist/react-dom.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But if you're looking at using React on more than one small part of your application, the depth of the rabbit hole can quickly become overwhelming. Wanting to deeply learn React usually leads to a plethora of over things to learn: ES6, JSX, Babel, Webpack, and much moreâ€Š–â€Šeach of these requiring a significant time investment to really understand.&lt;/p&gt;

&lt;p&gt;Then, even after acquiring a deep knowledge of these subjects, you'll still spend a significant amount of time in configuration on most non-trivial projects.&lt;br&gt;
But what if you just want to try React itself? Or what if you want to start with a set of configuration defaults and then modify those defaults as you go along?&lt;/p&gt;

&lt;p&gt;Well, there's hope: Create React App.&lt;/p&gt;

&lt;p&gt;Last summer, Facebook released Create React App, a boilerplate tool with a sensible set of configuration standards so you can quickly get started with React itself and then go down the rabbit hole at your own pace.&lt;/p&gt;

&lt;p&gt;Create React App comes bundled with Webpack, ESLint, Babel, Autoprefixer, Jest, and other great tools from the community.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why Headless WordPress?
&lt;/h3&gt;

&lt;p&gt;Okay, so WordPress is great. React is great. So why should we combine the two?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;JavaScript is the future of WordPress&lt;/strong&gt;. In late 2015, Automattic, the company behind WordPress, re-wrote their entire admin application (&lt;a href="https://developer.wordpress.com/calypso/" rel="noopener noreferrer"&gt;codenamed “Calypso”&lt;/a&gt;) in JavaScript. And a few weeks later, Matt Mullenweg, CEO of Automattic, gave a massive homework assignment to all WordPress developers: “&lt;a href="http://wesbos.com/learn-javascript/" rel="noopener noreferrer"&gt;learn JavaScript, deeply&lt;/a&gt;.”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Because a frontend/backend split is good for the worldâ€Š–â€Šboth users and developers&lt;/strong&gt;. Better user experiences are possible. Maintaining large codebases is more efficient. Better performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Your company can hire more specialized talent&lt;/strong&gt;. Frontend engineers don't have to know WordPress and vice-versa. Instead of hiring a generalist WordPress theme/plugin developer, you can hire separate roles who each have a deep knowledge of frontend engineering and Wordpress, respectively.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Onward!
&lt;/h2&gt;

&lt;p&gt;Okay, so now that we've established why this matters, let's dive in!&lt;/p&gt;
&lt;h3&gt;
  
  
  What We'll BeÂ Building
&lt;/h3&gt;

&lt;p&gt;For this tutorial, we'll be building a simple app that displays data about each of the Star Wars movies. The data will be supplied by a WordPress REST API we'll build, and we'll consume it with a React frontend built with Create React App.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step One: Create New WordPress Installation
&lt;/h3&gt;

&lt;p&gt;I won't go into much depth on this, as there are thousands of resources on the web for setting up a WordPress installation.&lt;/p&gt;

&lt;p&gt;If this is your first time delving into WordPress, then I'll assume you don't have a local environment set up. There are some out-of-the-box solutions, such as MAMP and DesktopServer, which are great for getting going quickly. Currently, I'm using &lt;a href="http://wpbeaches.com/setting-up-a-wordpress-vvv-vagrant-workflow/" rel="noopener noreferrer"&gt;Vagrant with Varying Vagrant Vagrants and Variable VVV&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9v294tl6xpr85xhgzq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9v294tl6xpr85xhgzq2.png" alt="vv + VVV = Awesome Local Environment for WordPress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have your new WordPress install set up, go ahead and visit your admin dashboard: &lt;code&gt;http://your-site.dev/wp-admin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgl1hwh0ceug5xaa6dqjg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgl1hwh0ceug5xaa6dqjg.png" alt="Look at that fancy new install! âœ¨"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step Two: Install the WordPress REST API Plugin (may not be required)
&lt;/h3&gt;

&lt;p&gt;This step is only required if you are running a WordPress version older than 4.7. You can check what version of WordPress you are running by going to Dashboard&amp;gt;Updates:&lt;/p&gt;

&lt;p&gt;~&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ulprgrplr38rga2d5sl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ulprgrplr38rga2d5sl.png" alt="WordPress Dashboard - Updates Section"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As of WordPress 4.7, the WP-API is &lt;a href="https://developer.wordpress.org/rest-api/" rel="noopener noreferrer"&gt;integrated into WordPress core&lt;/a&gt;. So if you're running 4.7 or greater, you're good to go.&lt;/p&gt;

&lt;p&gt;Otherwise, navigate to Plugins&amp;gt;Add New and search for “WordPress REST API (Version 2)”. Go ahead and Install it and then Activate it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step Three: SanityÂ Check
&lt;/h3&gt;

&lt;p&gt;Fire up your favorite API request tool (I like to use Postman) or a Terminal window if you prefer.&lt;/p&gt;

&lt;p&gt;Fire off a GET request to &lt;code&gt;http://your-site.dev/wp-json/&lt;/code&gt;. You should get back some JSON that contains all your WordPress site's resources and their respective endpoints.&lt;/p&gt;

&lt;p&gt;For a quick demo, send a GET request to &lt;code&gt;http://your-site.dev/wp-json/wp/v2/posts/1&lt;/code&gt;â€Š–â€Šyou should get back JSON with information about the “Hello World!” test post that comes with all new WordPress installs by default. If you already deleted the test post, you won't get anything back.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step Four: Install Plugins for thisÂ Project
&lt;/h3&gt;

&lt;p&gt;The next thing to do is install the plugins we'll need for this demo project. Go ahead and install these and then come back for the explanation of each (unless otherwise noted, each can be searched and installed from Plugins&amp;gt;Add New).&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;a href="https://wordpress.org/plugins/custom-post-type-ui/" rel="noopener noreferrer"&gt;CPT UI&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Custom Post Types (CPTs) is one of the most powerful features of WordPress. It allow you to create custom content types to go beyond the default Posts and Pages that WordPress ships with.&lt;/p&gt;

&lt;p&gt;While it's certainly possible (and pretty trivial) to create CPTs via PHP, I really like how easy CPT UI is to use. Plus, if you're reading this with no prior WordPress experience, I'd rather you be able to focus on the WP-API itself instead of WordPress and PHP.&lt;/p&gt;

&lt;p&gt;For our demo, we'll be creating a CPT called Movies.&lt;/p&gt;

&lt;p&gt;I'm going to cover how to manually add the Movies CPT, but if you'd like to skip that and just import the data, go to CPT UI&amp;gt;Tools and paste in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"movies": {
"name": "movies",
"label": "Movies",
"singular_label": "Movie",
"description": "",
"public": "true",
"publicly_queryable": "true",
"show_ui": "true",
"show_in_nav_menus": "true",
"show_in_rest": "true",
"rest_base": "movies",
"has_archive": "false",
"has_archive_string": "",
"exclude_from_search": "false",
"capability_type": "post",
"hierarchical": "false",
"rewrite": "true",
"rewrite_slug": "",
"rewrite_withfront": "true",
"query_var": "true",
"query_var_slug": "",
"menu_position": "",
"show_in_menu": "true",
"show_in_menu_string": "",
"menu_icon": "",
"supports": [
"title",
"editor",
"thumbnail"
],
"taxonomies": [],
"labels": {
"menu_name": "",
"all_items": "",
"add_new": "",
"add_new_item": "",
"edit_item": "",
"new_item": "",
"view_item": "",
"search_items": "",
"not_found": "",
"not_found_in_trash": "",
"parent_item_colon": "",
"featured_image": "",
"set_featured_image": "",
"remove_featured_image": "",
"use_featured_image": "",
"archives": "",
"insert_into_item": "",
"uploaded_to_this_item": "",
"filter_items_list": "",
"items_list_navigation": "",
"items_list": ""
},
"custom_supports": ""
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for the manual process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to CPT UI&amp;gt;Add/Edit Post Types&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For the Post Type Slug, enter &lt;code&gt;movies&lt;/code&gt;â€Š–â€Šthis is the URL slug WordPress will use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For the Plural Label, enter &lt;code&gt;Movies&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For the Singular Label, enter &lt;code&gt;Movie&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt; Scroll down to the Settings area and find the “Show in REST API” option. By default, this is set to False. If you don't change it to True, you will not be able to query this CPT using the WP-API. Right underneath that option, you should see the “REST API base slug” optionâ€Š–â€Šyou can enter &lt;code&gt;movies&lt;/code&gt; here.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll all the way down and click Add Post Type.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You should see a new Movies option appear in the sidebar:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fefzeqcvim8llb88lkjbj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fefzeqcvim8llb88lkjbj.png" alt="Movies appeared in the WordPress Dashboard side bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://wordpress.org/plugins/advanced-custom-fields/" rel="noopener noreferrer"&gt;Advanced Custom Fields&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Speaking in database terms, if CPTs are the tables, Custom Fields are the columns. This isn't actually how WordPress stores CPTs and Custom Fields in its database, but I find this illustration helpful to those who have limited to no WordPress experience. CPTs are the resource (i.e. “Movies”) and Custom Fields are the metadata about that resource (i.e. “Release Year, Rating, Description”).&lt;/p&gt;

&lt;p&gt;Advanced Custom Fields (ACF) is the plugin for WordPress Custom Fields. Of course, you can create Custom Fields with PHP (just like CPTs), but ACF is such a time-saver (and it's a delight to use).&lt;/p&gt;

&lt;p&gt;You can get this one from Plugins&amp;gt;Add New, but if you want to use the import function to import my sample data, you'll need the Pro version, &lt;a href="https://www.advancedcustomfields.com/pro/" rel="noopener noreferrer"&gt;which you can find here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you have the Pro version, go to Custom Fields&amp;gt;Tools after Activating the plugin. You can then paste in this JSON to import the fields you'll need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
{
"key": "group_582cf1d1ea6ee",
"title": "Movie Data",
"fields": [
{
"key": "field_582cf1d9956d7",
"label": "Release Year",
"name": "release_year",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"min": "",
"max": "",
"step": ""
},
{
"key": "field_582cf1fc956d8",
"label": "Rating",
"name": "rating",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"min": "",
"max": "",
"step": ""
},
{
"key": "field_5834d24ad82ad",
"label": "Description",
"name": "description",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"maxlength": "",
"rows": "",
"new_lines": "wpautop"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "movies"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
}
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you don't have the Pro version, here's how to setup your Custom Fields:&lt;/p&gt;

&lt;h5&gt;
  
  
  Create the Field Group
&lt;/h5&gt;

&lt;p&gt;ACF organizes collections of Custom Fields in Field Groups. This is domain-specific to ACF. That's all you really need to know about Field Groups for now.&lt;/p&gt;

&lt;p&gt;1.Go to Custom Fields&amp;gt;Field Groups&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click “Add New”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For the Field Group title, enter “Movie Data”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down until you see the Location metabox. Set this Field Group to only show if Post Type is equal to Movie:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh99fvmvnmfu6q8r26lmj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh99fvmvnmfu6q8r26lmj.png" alt="ACF Display Settings for Field Group"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can then scroll down to the Settings metabox. You should be able to leave all these options set to their defaults, but you can still give it a once over compared against this screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjib5uzs690zm4clhm4uu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjib5uzs690zm4clhm4uu.png" alt="ACF Movies field group settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, click Update to save your Field Group settings.&lt;/p&gt;

&lt;h5&gt;
  
  
  Create the Custom Fields
&lt;/h5&gt;

&lt;p&gt;First, create a Release Year field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Field Label: Release Year
Field Name: release_year
Field Type: Number
Required? No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next is the Rating field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Field Label: Rating
Field Name: rating
Field Type: Number
Required? No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And lastly, the Description field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Field Label: Description
Field Name: description
Field Type: Text Area
Required? No
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forget to click Update to save your new Custom Fields.&lt;/p&gt;

&lt;p&gt;Now, if you to to Movies&amp;gt;Add New, and then scroll down a bit, you should see a metabox called Movie Data (the name of your field group) along with each of the Custom Fields you created inside it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6fkfvgd02yqe6wu1ez1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6fkfvgd02yqe6wu1ez1.png" alt="The Movies field group now appears if on the New Movie page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://wordpress.org/plugins/acf-to-rest-api/" rel="noopener noreferrer"&gt;ACF to REST API&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Now that we have our Custom Fields, we need to expose them to the WP-API. ACF doesn't currently ship with WP-API support, but there's a great plugin solution from the community called ACF to REST API. All you have to do is install (you can find it by searching for it at Plugins&amp;gt;Add New) and activate it, and it will immediately expose your ACF custom fields to the API.&lt;/p&gt;

&lt;p&gt;If we had created our Custom Fields directly via PHP (without the use of a plugin), there's also a couple of nifty functions for exposing the field to the API. &lt;a href="https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/" rel="noopener noreferrer"&gt;More on that here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step Five: Post DataÂ Import
&lt;/h3&gt;

&lt;p&gt;This is the last step to get our WordPress installation ready to serve our Star Wars data.&lt;/p&gt;

&lt;p&gt;First, we need to import all the Movies. Lucky for you, I already did all the manual work and all you have to do is import a nifty file.Â :-)&lt;/p&gt;

&lt;p&gt;Go to Tools&amp;gt;Import. At the bottom of the page you should see an option to import from WordPress with an Install Now link underneath:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwkthbferproxfbvrm1da.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwkthbferproxfbvrm1da.png" alt="Screenshot of WordPress Import screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the WordPress Import installs, you should see a link to run the importer. Click that and &lt;a href="https://gist.github.com/jchiatt/75b9d8218c09a8a881770399343da69a#file-movie-data-xml" rel="noopener noreferrer"&gt;import this file at the next screen&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The next screen will ask you to assign the imported posts to an author. You can just assign them to your default admin account and click Submit:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5hc9vpwt3qwniyvtg4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5hc9vpwt3qwniyvtg4h.png" alt="Post-import screen for new author assignment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, go to Movies&amp;gt;All Movies. You should see a listing of Star Wars movies (Episodes 1–7). Because I developed in my local environment, the import file couldn't import the featured images for the Movies (it couldn't fetch them from the origin server), so you'll have to add those manually (it only takes about 30 seconds).&lt;/p&gt;

&lt;p&gt;My preferred way (and the fastest way) is to hover over each of the posts on the All Movies page and hold Command (Control on Windows) and click Edit for each one. This will open one tab for each Movie.&lt;/p&gt;

&lt;p&gt;On each of the edit pages, in the right sidebar, find the Featured Image metabox and click Set Featured Image. &lt;a href="http://files.builtbygood.co/B8Ej/1YcE71CU" rel="noopener noreferrer"&gt;Here's a ZIP file with each of the images you'll need&lt;/a&gt;. Or you can use any other images you'd like.&lt;/p&gt;

&lt;p&gt;For the first one, it's easiest to upload all the images to the Image modal that you see when you click Set Featured Image and then only select the one you need for that first Movie (this will save you the time of uploading each image individually across all your Movies):&lt;/p&gt;

&lt;p&gt;If that seems unclear, &lt;a href="http://files.builtbygood.co/2z0c/5gaJ5HKh" rel="noopener noreferrer"&gt;here's a GIF&lt;/a&gt; that will hopefully make more sense than my poor attempt at explanation.&lt;/p&gt;

&lt;p&gt;For each Movie, be sure to click Update after selecting featured image.&lt;/p&gt;

&lt;p&gt;Now you're good to go! Now leave your WordPress server running and let's move on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step Six: Install Create ReactÂ App
&lt;/h3&gt;

&lt;p&gt;Assuming you already have Node and npm installed on your machine, simply run this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g create-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! You're ready to use Create React App.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step Seven: Create theÂ App
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cd&lt;/code&gt; into the directory you'd like to create the frontend (this doesn't have to be (and shouldn't be) the same directory as your WordPress installation). Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create-react-app headless-wp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The process will take a few minutes, but once it's complete you should be able to cd into the newly created &lt;code&gt;headless-wp&lt;/code&gt; directory. From there, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command fires off a number of things, but all you need to know at the moment is that it'll boot up a Webpack dev server. Your browser should automatically open to &lt;code&gt;http://localhost:3000&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgk6i7b6ilhc0oveuhz7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgk6i7b6ilhc0oveuhz7i.png" alt="The default page when you first boot up your new React app."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can leave the server running in your shell. Hot reloading will automatically refresh your webpage every time you save a file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step Eight: Create Your Component
&lt;/h3&gt;

&lt;p&gt;Since this demo app is very simple, we'll only be using one component. We could easily create another component (it's as easy as creating another &lt;code&gt;ComponentName.js&lt;/code&gt; file and importing it into its parent component), but we're instead going to edit our &lt;code&gt;App.js&lt;/code&gt; component.&lt;/p&gt;

&lt;p&gt;Open up &lt;code&gt;App.js&lt;/code&gt;. You can go ahead and delete all the existing code from this file except for the first and last lines.&lt;/p&gt;

&lt;p&gt;At this point, &lt;code&gt;App.js&lt;/code&gt; should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from 'react';
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, create the &lt;code&gt;render()&lt;/code&gt; function for this component. This function gets called every time the state changes. If you aren't sure what this means, have some patience. It'll make sense soon.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;App.js&lt;/code&gt; should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from 'react';
class App extends Component {
  render() {
    return (
      &amp;lt;div&amp;gt;
        &amp;lt;h2&amp;gt;Star Wars Movies&amp;lt;/h2&amp;gt;
      &amp;lt;/div&amp;gt;
    )
  }
}
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whatever &lt;code&gt;render()&lt;/code&gt; returns is what gets painted on the DOM. If you save this file and go back to your browser, it should automatically reload and you should see this &lt;code&gt;h2&lt;/code&gt; we created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fobmdc173hmo0h81h8km0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fobmdc173hmo0h81h8km0.png" alt="A shiny new h2!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is great and all, but what about all that great data we stored in WordPress about the Star Wars movies? Time to get that data!&lt;/p&gt;

&lt;p&gt;Update &lt;code&gt;App.js&lt;/code&gt; like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from 'react';
class App extends Component {
  constructor() {
    super();
    this.state = {
      movies: []
    }
  }
componentDidMount() {
    let dataURL = "http://headless-wp.dev/wp-json/wp/v2/movies?_embed";
    fetch(dataURL)
      .then(res =&amp;gt; res.json())
      .then(res =&amp;gt; {
        this.setState({
          movies: res
        })
      })
  }
render() {
return (
      &amp;lt;div&amp;gt;
        &amp;lt;h2&amp;gt;Star Wars Movies&amp;lt;/h2&amp;gt;
      &amp;lt;/div&amp;gt;
    )
  }
}
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We just added two new functions to our &lt;code&gt;render()&lt;/code&gt; function: &lt;code&gt;constructor()&lt;/code&gt; and &lt;code&gt;componentDidMount()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;constructor()&lt;/code&gt; function is where we initialize state. Since we're only dealing with some JSON about our movies, our state is going to be pretty simple. Our initial state will just be an empty &lt;code&gt;movies&lt;/code&gt; array since we're expecting to get back that JSON.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;componentDidMount()&lt;/code&gt; function fires after the component mounts. This is the best place to make external API calls, so this is where we've added our code to use the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="noopener noreferrer"&gt;fetch API&lt;/a&gt; to grab all the movies from our WordPress API (be sure to update the URL to reflect your own URL!). Then, we're taking the response, parsing it as JSON, and then pushing it into our state object.&lt;/p&gt;

&lt;p&gt;Once the response gets pushed into our state, the component will re-render by firing the &lt;code&gt;render()&lt;/code&gt; function because the state has changed. But this doesn't really matter right now, because currently our &lt;code&gt;render()&lt;/code&gt; function is still only returning a div with a &lt;code&gt;h2&lt;/code&gt; inside.&lt;/p&gt;

&lt;p&gt;Let's fix that.&lt;/p&gt;

&lt;p&gt;We're now going to add a bit of extra code to our &lt;code&gt;render()&lt;/code&gt; function that will take the JSON in the our state (currently stored in &lt;code&gt;this.state.movies&lt;/code&gt;) and &lt;code&gt;map&lt;/code&gt; each movie and its data into a &lt;code&gt;div&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;App.js&lt;/code&gt; should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from 'react';
class App extends Component {
  constructor() {
    super();
    this.state = {
      movies: []
    }
  }
componentDidMount() {
    let dataURL = "http://headless-wp.dev/wp-json/wp/v2/movies?_embed";
    fetch(dataURL)
      .then(res =&amp;gt; res.json())
      .then(res =&amp;gt; {
        this.setState({
          movies: res
        })
      })
  }
render() {
    let movies = this.state.movies.map((movie, index) =&amp;gt; {
      return &amp;lt;div key={index}&amp;gt;
      &amp;lt;img src={movie._embedded['wp:featuredmedia'][0].media_details.sizes.large.source_url} /&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Title:&amp;lt;/strong&amp;gt; {movie.title.rendered}&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Release Year:&amp;lt;/strong&amp;gt; {movie.acf.release_year}&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Rating:&amp;lt;/strong&amp;gt; {movie.acf.rating}&amp;lt;/p&amp;gt;
      &amp;lt;div&amp;gt;&amp;lt;strong&amp;gt;Description:&amp;lt;/strong&amp;gt;&amp;lt;div dangerouslySetInnerHTML={ {__html: movie.acf.description} } /&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    });
return (
      &amp;lt;div&amp;gt;
        &amp;lt;h2&amp;gt;Star Wars Movies&amp;lt;/h2&amp;gt;
      &amp;lt;/div&amp;gt;
    )
  }
}
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you save your file, the page will reload, but you still won't see the Star Wars movie data load on the page. That's because there's one last thing to add. We're mapping each of our movies to their own respective divs, and then storing all those movies inside the &lt;code&gt;movies&lt;/code&gt; variable in our &lt;code&gt;render()&lt;/code&gt; function. Now we just need to tell our &lt;code&gt;render()&lt;/code&gt; function to return our &lt;code&gt;movies&lt;/code&gt; variable by adding &lt;code&gt;{movies}&lt;/code&gt; underneath our &lt;code&gt;h2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finished &lt;code&gt;App.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Component } from 'react';
class App extends Component {
  constructor() {
    super();
    this.state = {
      movies: []
    }
  }
componentDidMount() {
    let dataURL = "http://headless-wp.dev/wp-json/wp/v2/movies?_embed";
    fetch(dataURL)
      .then(res =&amp;gt; res.json())
      .then(res =&amp;gt; {
        this.setState({
          movies: res
        })
      })
  }
render() {
    let movies = this.state.movies.map((movie, index) =&amp;gt; {
      return &amp;lt;div key={index}&amp;gt;
      &amp;lt;img src={movie._embedded['wp:featuredmedia'][0].media_details.sizes.large.source_url} /&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Title:&amp;lt;/strong&amp;gt; {movie.title.rendered}&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Release Year:&amp;lt;/strong&amp;gt; {movie.acf.release_year}&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Rating:&amp;lt;/strong&amp;gt; {movie.acf.rating}&amp;lt;/p&amp;gt;
      &amp;lt;div&amp;gt;&amp;lt;strong&amp;gt;Description:&amp;lt;/strong&amp;gt;&amp;lt;div dangerouslySetInnerHTML={ {__html: movie.acf.description} } /&amp;gt;&amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
    });
return (
      &amp;lt;div&amp;gt;
        &amp;lt;h2&amp;gt;Star Wars Movies&amp;lt;/h2&amp;gt;
        {movies}
      &amp;lt;/div&amp;gt;
    )
  }
}
export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switch back over to your browser window and you should see the Star Wars data after the page reloads:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z8ilavfw8kkvh516o5v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6z8ilavfw8kkvh516o5v.png" alt="May the Force be withÂ you."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Going Further
&lt;/h2&gt;

&lt;p&gt;This is only the beginning of what you can do with the WP-API and React. Both have many other features and both have &lt;strong&gt;huge&lt;/strong&gt; communities.&lt;/p&gt;

&lt;p&gt;You can take the WP-API further by learning about authentication and POST requests, custom endpoints, and more complex queries.&lt;/p&gt;

&lt;p&gt;And as I said earlier, Create React App is made for you to just get your feet wet. When you're ready to learn more, you can learn more about things like Redux, ES6, Webpack, React Native, and more.&lt;/p&gt;

&lt;p&gt;I'll be covering many of these topics and more in future posts, so be sure to check back. Or if you'd prefer to have these posts sent directly to your inbox, &lt;a href="//mailto:jc@builtbygood.co"&gt;shoot me an email&lt;/a&gt; and I'll add you to my mailing list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Questions?
&lt;/h2&gt;

&lt;p&gt;I'm happy to help! Leaving a comment below is the fastest way to get a response (plus, it helps others who have the same problem!). Otherwise, &lt;a href="https://twitter.com/jchiatt" rel="noopener noreferrer"&gt;drop me a line on Twitter&lt;/a&gt; or &lt;a href="//mailto:jc@builtbygood.co"&gt;shoot me an email&lt;/a&gt; and I'll do what I can to help!&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>javascript</category>
      <category>react</category>
      <category>wpapi</category>
    </item>
  </channel>
</rss>
