Batuhan Tozun Batuhan Tozun - 5 months ago 33
React JSX Question

How can I check state is different from the props?

I have a props for example "shop_name" (this getting from redux). And I have to check this props different from my state's "shop_name" and disable my button.

For now i'm checking via this method;

isChanged() {
const changedShopName = this.state.shop_name !== this.props.shop_name;

return changedShopName;

And i'm passing new state with onchange func. and saving with this save func.;

onChange(event) {
const name =;
const value =;

[name]: value

saveSellerInfos() {
const data = {
shop_name: this.state.shop_name,


And here is my button with disabled field;


After the save function this props is not updating normally. How can i check nextProps after the save function and disabled my button?

Answer Source

this encapsulated in Button is not what you think it is, you will need to use .bind . as described here:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download