You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am changing the value of a default prop and seeing subsequent "hmr update" logs in the terminal. The new value of the prop does not show up in the component when no value is passed for the prop to the component (i.e., the default is used).
This is something that should be handled at the Fast Refresh level, but it's not and probably never will be because fast refresh was released in 2019, 4 years after default parameters have been a thing in the language. I'm quite impressed that this as not been deprecated yet.
You should rewrite your code like this
functionApp({ title ='Vite + React (test)!'}){
and also consider using TS:
functionApp({ title ='Vite + React (test)!'}: {title?: string}){
Company constraints 🤷 . It works with Webpack, so it's a bit annoying to introduce this regression when switching build tools. Given that defaultProps are getting deprecated in v19, I'll move over to default parameters.
Describe the bug
I am changing the value of a default prop and seeing subsequent "hmr update" logs in the terminal. The new value of the prop does not show up in the component when no value is passed for the prop to the component (i.e., the default is used).
Reproduction
https://stackblitz.com/edit/vitejs-vite-velxyz?file=src%2FApp.jsx
Steps to reproduce
title
indefaultProps
<h1>
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: