I am trying to create this HOC–>
export const hocGrid = (Grid) => {
return ({ data, config, id = uuidv4(), adaptableReady, autosizeAllColumns, removeLoader }) => {
return (
<Grid data={data} config={config} id={id} adaptableReady={adaptableReady} autosizeAllColumns={autosizeAllColumns} removeLoader={removeLoader} />
)
}
}
this Grid
component receives data and config as props, data is array of object and config is object
I want to modify these data and config and then pass to Grid
. Is this possible through HOC?
2
Answers
You can manipulate props in a Higher-Order Component before passing them down to the child component.
You can modify
data
andconfig
in the body of the inner function