The items that are rendered in Drawer components are rarely static. Instead, the drawer items are rendered based on the state of your component, allowing for more control over how items are displayed.
Drawer item state
How to do it...
Let's say that you have a component that renders drawer navigation using the Drawer component. Instead of writing the items state directly in the component markup, you want to have the items state stored in the state of the component. For example, in response to permission checks on the user, items might be disabled or completely hidden.
Here's an example that uses an array of item objects from the component state:
import React, { useState } from 'react';
import Drawer from...