Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // parent
- {this.state.files.map((file, index) => (
- <Image
- onColorChange={(color) => this.onColorChange(color, index)}
- )}
- onColorChange = (color, index) => {
- this.setState({
- files: this.state.files.map((file, i) => {
- if (index !== i) return file;
- return {
- ...file,
- color,
- };
- }),
- });
- }
- // image
- onChange(color) {
- this.props.onColorChange(color)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement