Everything you've rendered so far in this book has been straightforward declarative HTML. Life is never so simple: sometimes, your React components need to implement some imperative code under the covers.
This is the key – hiding the imperative operations so that the code that renders your component doesn't have to touch it. In this section, you'll implement a simple jQuery UI button React component so that you can see how the relevant life cycle methods help you to encapsulate the imperative code.
Rendering jQuery UI widgets
The jQuery UI widget library implements several widgets on top of standard HTML. It uses a progressive enhancement technique whereby the basic HTML is enhanced in browsers that support newer features. To make these widgets work, you first need to render HTML into the DOM somehow; then, you need to make imperative function calls to create and interact with the widgets.
In this example, you'll create a React...