Chapter 6. Integrating third-party libraries with React
This chapter covers
- Sending form data in JSON format to a remote API
- Building some new kinds of components, including a location-picker, type-ahead, and a display map
- Integrating your React app with Mapbox to search locations and display maps
In chapter 5, we started looking at forms and how they work in React. You added event handlers to update component state in the CreatePost component. In this chapter, you’ll build on that previous work and work on adding the ability to create new posts. You’ll start interacting more with the JSON API that provided posts to render in the last chapter.
Often, you’ll build React applications in a context that involves non-React libraries that also work with the DOM. These might include things like jQuery, jQuery plugins, or even other front-end frameworks. We’ve seen that React manages the DOM for you and that this can simplify how you think about user interfaces. There are still times, though, where you need to interact with the DOM, and it’s often in the context of third-party libraries that use it. We’ll explore some ways you can go about doing that with React in this chapter as you add Mapbox maps to posts in Letters Social.