Change editor state

When I use view.setState first time, all works, but when I use this again, it throws errors.

Is that any method that I can use instead view.setState?

setState shouldn’t be throwing an error, though it is a very inefficient way to update state. The docs all explain you have to use dispatch with a transaction instead.

Thanks for your answer, I found a bug in my code that couses this error. I thought that setState is not working but bug was caused by line before.