From 8115138a0a7a0d31b64f52573e4718ff560b052b Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 4 Jul 2018 02:02:54 +0300 Subject: [PATCH] Diff responds to value change (#480) --- src/diff.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/diff.js b/src/diff.js index 9159b34c..13563913 100644 --- a/src/diff.js +++ b/src/diff.js @@ -13,6 +13,14 @@ export default class DiffComponent extends Component { this.diff = this.diff.bind(this); } + componentWillReceiveProps(props) { + const {value} = props; + + if (value !== this.state.value) { + this.setState({value}); + } + } + onChange(value) { this.setState({ value: value