Fast refresh not working as expected
See original GitHub issueBug report
Describe the bug
Fast refresh isn’t working as expected. Running the following code with next ^9.4.0
if I edit any
To Reproduce
import { useState, useCallback } from 'react'
export default () => {
const [counter, setCounter] = useState(0);
const incrementCount = useCallback(() => {
setCounter(x => x + 1)
}, [counter])
return (
<div className="container">
<h1>Hello Next!!</h1>
<button onClick={incrementCount}>
Clicked {counter} times
</button>
</div>
)
}
(pages/index.tsx)
When I update any piece of code the page fully reload as usual… Am I doing something wrong?
Expected behavior
I expect the page to maintain the state.
System information
- OS: macOS,
- Browser (if applies) Firefox developer edition
- Version of Next.js: 9.4
- Version of Node.js: 13.1.0
Extra config
- No
next-config.js
- Postcss and Sass are installed.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Fast refresh not working properly due to page reload ... - GitHub
Hey! I was facing the same issue until I found the problem: something that is imported in the middleware and somewhere in the...
Read more >NextJS Fast refresh not working as expected - Stack Overflow
The fast refresh feature is working perfectly with other components but has problem with this specific component only.
Read more >Fast Refresh - React Native
Fast Refresh. Fast Refresh is a React Native feature that allows you to get near-instant feedback for changes in your React components.
Read more >react-hot-loader - npm
React-Hot-Loader is expected to be replaced by React Fast Refresh. Please remove React-Hot-Loader if Fast Refresh is currently supported on ...
Read more >7 Refreshing Materialized Views - Oracle Help Center
For materialized views that use the log-based fast refresh method, ... In addition, it helps to avoid potential problems such as materialized view...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It would be nice if
next.js
automatically generated/set names for defaultly exported arrow function pages.For example:
could automatically be named:
Home
/HomePage
.Thank you! Resolved by adding
displayName
to the component.Now it’s working as expected. Thanks!