Duplicate style render on SSR

Viewed 359

I'm currently developing CMS with Gatsby and emotion. Style is duplicately generated even same class is allocated.

I think there's multiple of solution(like using postCSS), but I'd like to grasp the cause of it.

import React from 'react';
import PropTypes from 'prop-types';
import tw from 'twin.macro';
import styled from '@emotion/styled';
const StyledComponent = styled.section``;
const Section = ({ component: Component, children, ...other }) => (
  <StyledComponent css={tw`bg-white`} {...other}>
    {children}
  </StyledComponent>
);

Here's rendered result on browser(CSS Style is literally duplicated)

enter image description here

Above problem occurs only in production environment.

0 Answers
Related