From the course: Build a JavaScript AI App with React and the OpenAI API
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Integrate the AI API response
From the course: Build a JavaScript AI App with React and the OpenAI API
Integrate the AI API response
- [Instructor] In between the previous movie and this one I've added a couple of significant changes to keep us moving forward. Specifically, I've added a new component called description, that just displays the description that we created using OpenAI. The description component is used down here in app JSX right after the error message in the main form. So if we have a weather description then we output the description component with the weather description data. Otherwise we just output the description component. Now you may wonder, hey, what happens if you output a component that is supposed to have data but doesn't have data? Well, if we go over and look at the description component you'll see it's really straightforward. All it does is return a div with an h1 that says description and then another div and the actual description. And then down here I've used default props to say if you don't have a weather description…