From the course: Learning webpack 4
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using @babel/preset-react
- [Instructor] Let's make some adjustments to our project to use React instead of jQuery. The first step I'm going to take, is to install React and React dom as dependencies using the save flag, then I'm going to go back to my Index JS file, and I'm going to replace this code with the following, so I'm import React from react, I also will render from react dom, and I'm just going to create a simple component here called Greeting, which returns an H one, and this H one should say "Hello from React." Finally, we want to render this, and remember we have that element called Target that we can mount this to, so I'll say that the greeting should be our component that is added to the dom at Target. Perfect. So now to use React web pack and Babel together. I need to install that one last preset, so I'll say N-P-M install at Babel slash preset hyphen React, and I'll save that as a dev dependency. Excellent. At this point, I'm going to go back to the code and open the webpack in config file. I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.