From d91ca48074857fdccb33bdbd427413eb7f4208a7 Mon Sep 17 00:00:00 2001 From: Andrii Date: Wed, 6 Apr 2016 12:00:30 +0200 Subject: [PATCH 1/2] render of the react component under manual control --- index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.html b/index.html index 278db3c..4f13689 100644 --- a/index.html +++ b/index.html @@ -95,6 +95,9 @@ componentWillUnmount() { $(this.refs.queryBuilder).queryBuilder('destroy'); } + componentShouldUpdate() { + return false; + } // get data from jQuery Query Builder and pass to the react component handleGetRulesClick() { const rules = $(this.refs.queryBuilder).queryBuilder('getRules'); @@ -106,6 +109,7 @@ newRules.rules[0].value = newRules.rules[0].value + 10; $(this.refs.queryBuilder).queryBuilder('setRules', newRules); this.setState({rules: newRules}); + this.forceUpdate(); } render() { From 0aa61f6e43fbf8661c50ae518e02ea9fc35c100c Mon Sep 17 00:00:00 2001 From: Andrii Date: Wed, 6 Apr 2016 12:04:40 +0200 Subject: [PATCH 2/2] fix wrong lifecycle method name --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 4f13689..6189c1e 100644 --- a/index.html +++ b/index.html @@ -95,13 +95,14 @@ componentWillUnmount() { $(this.refs.queryBuilder).queryBuilder('destroy'); } - componentShouldUpdate() { + shouldComponentUpdate() { return false; } // get data from jQuery Query Builder and pass to the react component handleGetRulesClick() { const rules = $(this.refs.queryBuilder).queryBuilder('getRules'); this.setState({rules: rules}); + this.forceUpdate(); } // reinitialize jQuery Query Builder based on react state handleSetRulesClick() {