Closed RubenVerborgh closed 4 years ago
Since it was used in a code demo (see #6) I just assumed that these fields would be set, because they were. I've now removed that assumption in the master
branch and rebased the specific example branches on top of that, so that should fix this.
When a service would return
undefined
for name or nick (as is allowed by the type), and the value would be updated by the user, the respective field would change from uncontrolled to controlled state, leading toThe direct cause was that
React.useState<string>()
was called without supplying a default value of""
. However, when changing that, the render logic (in particular thevalue
property) would fail.The root cause of this is that the same state was being maintained twice:
name
andnickname
were additionally modeled viaprofileData
.This PR untangles that logic and fixes the React warning.