From the course: Learning App Building with Vanilla JavaScript
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Create elements with vanilla JavaScript - JavaScript Tutorial
From the course: Learning App Building with Vanilla JavaScript
Create elements with vanilla JavaScript
- [Instructor] Our app is currently using React to make changes to the view in response to user interaction. Now, we already have a state variable which tracks the current values of several properties related to both user choices and Ajax data. When the state changes, our app calls the appropriate function to change the view with React. We're going to take out the React components altogether and then build out replacement code for DOM manipulation using vanilla JavaScript. So, starting with the first component on line 66, we'll comment out the ReactDOM.render statement and then we'll comment out the forecast function which is our React component for the city and weather information in our view. And then before the updateActivityList function call, we'll start our DOM manipulation code with statements to create elements. So, looking at the JSX for this React component, we can see that the structure consists of a div element and within that two p elements and within the second p element…
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.