Hello,
Where is my mistake in consuming the context?
react dev tools and visual studio shows the: path: value.path,
Here comes the process of creating and providing and consuming the context:
import React from 'react';
const ImageContext = React.createContext()
export default ImageContext;
onFileChangeName = event => {
this.setState({ selectedFileName: event.target.files[0].name });
};
return (
<ImageContext.Provider value={this.onFileChangeName}>
</ImageContext.Provider >
);
return (
<ImageContext.Consumer>
{value => (
<ImageEditor
includeUI={{
loadImage: {
path: value.path,
name: value,
},
</ImageContext.Consumer>
);
}
Please inform me.
thanks,
Saeed