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
When using @emotion/styled in a React application, styles associated with inactive or unmounted components persist in the of the document. This results in an accumulation of unused styles, which can potentially bloat the page and affect performance.
To reproduce:
Create a React component styled with @emotion/styled.
Render the component in your application.
Navigate away from the component or unmount it.
Observe that the styles associated with the unmounted component remain in the of the document
import React from 'react';
import styled from '@emotion/styled';
Styles associated with unmounted or inactive components should be automatically removed from the of the document to prevent unnecessary accumulation of styles.
The text was updated successfully, but these errors were encountered:
You're leaving out some crucial information like removed from the ... of the document or components persist in the ... of the document
I suggest proofreading the content you got and making the issue clear and readable.
Thanks 🙏
Current behavior:
When using @emotion/styled in a React application, styles associated with inactive or unmounted components persist in the of the document. This results in an accumulation of unused styles, which can potentially bloat the page and affect performance.
To reproduce:
import React from 'react';
import styled from '@emotion/styled';
const DynamicContent = styled.div
color: blue; width: 200px; background-color: lightgrey; padding: 10px;
;const PageOne = () => (
This is Page One
);
const PageTwo = () => (
This is Page Two
);
const App = () => {
const [currentPage, setCurrentPage] = React.useState('PageOne');
};
export default App;
Expected behavior:
Styles associated with unmounted or inactive components should be automatically removed from the of the document to prevent unnecessary accumulation of styles.
The text was updated successfully, but these errors were encountered: