From 9f7677aea2cab1bc99da1d99093cd92614b6bde4 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 15 Nov 2018 19:06:28 +0100 Subject: [PATCH] No need to use the state to store the lastHtmlSent var --- src/app/AppContainer.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/app/AppContainer.js b/src/app/AppContainer.js index c94215127e..bd4e9b0919 100644 --- a/src/app/AppContainer.js +++ b/src/app/AppContainer.js @@ -26,19 +26,13 @@ type PropsType = { initialHtml: string, }; -type StateType = { - lastHtmlSent: string, -}; - -class AppContainer extends React.Component { +class AppContainer extends React.Component { constructor( props: PropsType ) { super( props ); this.parseBlocksAction( props.initialHtml ); - this.state = { - lastHtmlSent: '', - }; + this.lastHtmlSent = null; } onChange = ( clientId, attributes ) => { @@ -72,10 +66,8 @@ class AppContainer extends React.Component { serializeToNativeAction = () => { const html = serialize( this.props.blocks ); - RNReactNativeGutenbergBridge.provideToNative_Html( html, this.state.lastHtmlSent !== html ); - this.setState( { - lastHtmlSent: html, - } ); + RNReactNativeGutenbergBridge.provideToNative_Html( html, this.lastHtmlSent !== html ); + this.lastHtmlSent = html; }; mergeBlocksAction = ( blockOneClientId, blockTwoClientId ) => {