Creating a View Toggle Button

Build a React component that can toggle between two areas of the render function.

It’s cumbersome to scroll past the widgets to see the rendered people data. Let’s build a small toggle button that lives in App.tsx and toggles rendering for either the widgets or the people data.

Adding a stateful variable showPeople

First, let’s introduce a stateful variable that does the actual toggling.

Get hands-on with 1200+ tech skills courses.