React Imported SVG as CSS Background

Share on facebook
Share on google
Share on twitter
Share on linkedin
** You will need to have “styled-components”

import { renderToStaticMarkup } from 'react-dom/server';

const DividerWave = styled.div`
  background: ${`url("data:image/svg+xml,${
    encodeURIComponent(renderToStaticMarkup(<BoiledEggSvg />))
  }")`}
`