i do have a component in which
state={
mediaJson=[]
}
and i have a reducer which calls an API and returns data and i used
static getDerivedStateFromProps(props, state) {
return{
mediaJson:props.data
}
i am getting the data and ist getting displayed
as per my understanding its kind of setting to the state named mediaJson ,again in another click function
tabClicks = (val) => {
const mediaContent = [...this.state.mediaJson];
}
and tried to console mediaContent this am getting undefined