From 97746777c5a9bfec059e2753307062180c08de3a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 27 Aug 2018 16:06:26 +0300 Subject: immutability-helper --- vnext/src/components/Settings.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'vnext/src/components') diff --git a/vnext/src/components/Settings.js b/vnext/src/components/Settings.js index 2a24e35c..2f03671f 100644 --- a/vnext/src/components/Settings.js +++ b/vnext/src/components/Settings.js @@ -1,5 +1,7 @@ import React from 'react'; +import update from 'immutability-helper'; + import { me } from '../api'; import { UserType } from './Types'; @@ -39,9 +41,11 @@ export default class Settings extends React.Component { console.log('password update'); } emailChanged = (event) => { - this.setState({ - me: { activeEmail: event.target.value } + let newState = update(this.state, { + me: { activeEmail: {$set: event.target.value }} }); + this.setState(newState); + console.log('email update'); } disableTelegram = () => { console.log('telegram disable'); @@ -161,16 +165,16 @@ export default class Settings extends React.Component { {/** email_off **/}
{/** /email_off **/}-- cgit v1.2.3