Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setState() not changing the "value" props in Editor.render()? #13

Closed
tomkcey opened this issue Jul 18, 2019 · 4 comments
Closed

setState() not changing the "value" props in Editor.render()? #13

tomkcey opened this issue Jul 18, 2019 · 4 comments

Comments

@tomkcey
Copy link

tomkcey commented Jul 18, 2019

Greetings,

In this code, when I change the state of the component with setState(), it does go into the render() method, but does not actually change the display to reflect the new state.

I placed the this.state in the "value" props of the Editor component.

Here's a link to the code: demo-jsoneditor-react

@Victordmdb
Copy link

Did you manage to figure this out? I'm stuck at this too. It currently has a shouldComponentUpdate which only updates with changes to htmlElementProps.

To make it worked I added a key prop which changes if the value changes since this forces a new component to be generated. Not a great solution but nothing else seemed to work.

@tomkcey
Copy link
Author

tomkcey commented Jul 19, 2019

Nah, still waiting to see how he managed that. I'll return to it this afternoon.

@vankop
Copy link
Owner

vankop commented Jul 20, 2019

discussed here #3 .
If you want to continue discussion move there please

@vankop vankop closed this as completed Jul 20, 2019
@vankop
Copy link
Owner

vankop commented Jul 20, 2019

As discussed there you can get reference of JSONEditor and change state manually, because of breaking functionality. For changing state use #4 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants