Hello,
I am trying to render a custom React component inside the Grid Toolbar. I am using the template function of the Grid Item to achieve this, as suggested
here.
I am able to render the component, but when I update the React state in the parent component, my custom component in the toolbar disappears.
Requirement:
I need to render a custom React component inside the toolbar and the component should rerender correctly when the parent component is rerendered (through setState).
Reproduction scenario:
Please consider the following Codesandbox for the reproduction scenario:
When clicking the 'Click me' button in the center of the toolbar, it disappears.
I expect it to rerender with the updated count.
Further information:
As you can see in the Codesandbox, I am using a function to get the toolbar options (this.getToolbarOptions).
If I use a class variable instead of a function, then the button does not disappear, but it is also not rerendered.
Thanks,
Edwin