Skip to content

Commit

Permalink
No need to use the state to store the lastHtmlSent var
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Nov 15, 2018
1 parent 6ca5be8 commit 9f7677a
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/app/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,13 @@ type PropsType = {
initialHtml: string,
};

type StateType = {
lastHtmlSent: string,
};

class AppContainer extends React.Component<PropsType, StateType> {
class AppContainer extends React.Component<PropsType> {
constructor( props: PropsType ) {
super( props );

this.parseBlocksAction( props.initialHtml );

this.state = {
lastHtmlSent: '',
};
this.lastHtmlSent = null;
}

onChange = ( clientId, attributes ) => {
Expand Down Expand Up @@ -72,10 +66,8 @@ class AppContainer extends React.Component<PropsType, StateType> {

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 ) => {
Expand Down

0 comments on commit 9f7677a

Please sign in to comment.