ProductiveRage / Bridge.React

Bindings for Bridge.NET for React - write React applications in C#!
MIT License
74 stars 14 forks source link

New React Lifecycle #43

Open shergindenis opened 6 years ago

shergindenis commented 6 years ago

Hello! Are there plans to move to New React-lifecycle?

ProductiveRage commented 6 years ago

One of the problems that I have is that there is nothing tying these bindings to a particular version of React and so the project could be using a version of React that doesn't use the new life cycle methods. So I'm a bit worried about making the bindings rely on a particular version of React.. but that ties my hands a bit in terms of supporting new features!

A good example is that these bindings don't support returning an array of elements from Render methods, which were introduced in React 16, or the Fragment approach that did similar (that was added in 16.2.0, I think).

In terms of the new life cycle methods, if I understand it correctly then they are deprecating these:

And adding these:

.. so the changes are not enormous.. but I don't want Bridge.React to fall behind, either.

I will have a think about this. The easiest thing will be to add [Obsolete] tags to the deprecated life cycle methods so that their use gets flagged as a warning in Visual Studio. And I would like to try to have the package include some sort of warning if features are being used for a future version of React - for example, if you create a component that uses "getSnapshotBeforeUpdate" and your application has loaded a version of React that doesn't support it then you would get a descriptive warning in the browser console. Something similar could be done for Fragments.

So the short answer is that there are no solid plans yet. But I hope that it will happen relatively soon!