Using a Class Component with contextType

In this lesson we will learn how we can use contextType within class components.

We'll cover the following

React 16.6 introduced the ability to consume data from context without using the Consumer component directly. This helps cut down on unnecessary nesting in your components’ JSX, making them easier to read. To take advantage of contextType you’re required to work with a class component.

Consider the Benny component rewritten as a class component.

Get hands-on with 1000+ tech skills courses.