TL;DR: I have a function component in a library that has react@^16.3.0 as a peer dependency. Is it a breaking change if I wrap this component in React.forwardRef
?
According to the react docs in forwarding Refs#Note for component library maintainers introducing ref forwarding to your components is a breaking change.
I understand this for class components since before you would get a ref to the class and now you would get a ref to whatever you forward this to.
However for function components refs were never supported in the first place and would trigger warnings.
Is it safe to assume that introducing forwardRef to function components is a feature and not a breaking change?
For me this is similar to adding a new property to your API. Before I would get type errors whereas now I get a defined value. Overall this sounds like the docs state that the non-existence of a feature is actually a feature which would mean that every feature is a breaking change.
Edit:
React is already required as a peer with ^16.3.0
so we would already have access to forwardRef
. We would not require users to upgrade their react version.