Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Hot reloading not working on styled components with default export #456

Closed
nop33 opened this issue Jan 3, 2023 · 0 comments
Closed

Hot reloading not working on styled components with default export #456

nop33 opened this issue Jan 3, 2023 · 0 comments

Comments

@nop33
Copy link
Member

nop33 commented Jan 3, 2023

Hot Reloading when changing the CSS code for a styled component exported with export default is not working. A hard refresh is required to see the CSS changes.

const NavItem = ({ className} ) => <div className={className}>...</div>

export default styled(NavItem)`
  color: red;
`

The following works, however:

const NavItem = () => <NavItemContainer>...</NavItemContainer>

export default NavItem

const NavItemContainer = styled.div`
  color: red;
`

Related @vitejs/plugin-react issue: vitejs/vite-plugin-react#6

I wouldn't like to once again refactor the code and bring back the "containers" components. It adds extra friction to coming up with names...

@nop33 nop33 closed this as completed Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant