'How to pass extra params to frameworkComponents
frameworkComponents: { squareRenderer: SquareRenderer, }
how can I add extra parameters to SquareRenderer component?
Any workaround?
Solution 1:[1]
Try something like this. Wrap the component and pass whatever props you want:
const WrappedSquareRenderer = () => <SquareRenderer banana={banana} />;
frameworkComponents: { squareRenderer: WrappedSquareRenderer, }
Solution 2:[2]
Try the following
frameworkComponents: {
actionsRenderer: (params) => {
return new ItemRenderer(params, addParameter1, addParameter2);
},
}
Where ItemRenderer is a react component, you will get a warning because it does not like arrow functions but it works.
Solution 3:[3]
const Actions=()=>
frameworkComponents={{CellRenderer: child}}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Max |
| Solution 2 | Samuel Meza |
| Solution 3 | Prudhvi Mohan Cherukupalli |
