react95-io / React95

🌈🕹 Windows 95 style UI component library for React
https://react95.io
MIT License
6.6k stars 183 forks source link

chore(usecontrolledoruncontrolled): emulate React's uncontrolled warn if value is set without onChange or readOnly #352

Closed WesSouza closed 1 year ago

WesSouza commented 2 years ago

When using useControlledOrUncontrolled, we are providing our own onChange, which suppresses React's own warning.

This implements the same warning to our users.

This made me lose a lot of time while writing tests for <Select> given things weren't changing and I thought it was a code issue, when it was the test using value instead of defaultValue.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
react95 ✅ Ready (Inspect) Visit Preview Aug 12, 2022 at 0:55AM (UTC)
codesandbox-ci[bot] commented 2 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 46df64b2aa3384b9dcbf70da1e594de36a7cb91c:

Sandbox Source
React95 template Configuration
WesSouza commented 1 year ago

Included on #350.