recyclejs / recycle

Convert functional/reactive object description using RxJS into React component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use this.setState instead of this.state

edunuzzi opened this issue · comments

Using 'this.state = ...' has been deprecated by React. Shouldn't we change line 50 in 'component.js' to this.setState(newState)?

Line 50 in 'component.js'

this.state = this.componentState

Could become

this.setState(this.componenState)

There was a reason for this, but... I'm a bit embarrassed to say, I don't remember what it was 😅 (I think it was related to React update cycle and a fact that setState will try to rerender a component)

I will look in to it, but before making this kind of change or any other modification we must write more functional tests.

For a start, I was planning to write tests for current examples but never got around to do it.
If you are willing to help with that, you are more than welcome! :)

Oh, i see lol
We've all been there :P
Definitely! Later this week i will take a look at it!

I have changed this one line to use setState, as the direct assignment was giving me a deprecation warning. No problems so far, but I'll let you know if I notice something.

I've published a new version using setState.

Since it's not properly tested with React 16, it's a major version update