Controlling the state with props

In this example, we created a higher-level abstraction of the Menu component that accepts the values and onValuesChange props to control the state of the menu store. These props are then passed to the MenuProvider component:

<MenuProvider values={props.values} setValues={props.onValuesChange}>

You can leverage this technique to create your own custom menu components tailored to your specific requirements. Learn more about controlling the state on the Component providers guide.

Follow updates

Join 1,000+ subscribers and receive monthly updates with the latest improvements on Examples.

Read latest issue

No Spam. Unsubscribe at any time.