I'm currently trying to create an animation on an H2, using the pseudos ::before and after. But the ::before and ::after are not showing in my HTML. What am I doing wrong here? Looking at styled components docs this should just work. I'm aware of the weird animation function. But this does not have any influence in the before after. I already completely removed it but it still doesn't render.
import React from 'react'
import styled, { keyframes, css } from 'styled-components'
import PropTypes from 'prop-types'
const Wrapper = styled.h2`
  position: relative;
  font-size: 1.5rem;
  color: #ffffff;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  transform: scale3d(1,1,1);
  opacity: 1;
  &::before, &::after{
    content: ${(props) => props.text};
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    background: #333333;
    color: #ffffff;
    clip: rect(0, 900px, 0, 0);
  }
  &::before {
    left: 7px;
    text-shadow: 1px 0 green;
    animation: ${glitchEffect} 3s infinite linear alternate-reverse;
  }
  &::after {
    left: 3px;
    text-shadow: -1px 0 red;
    animation: ${glitchEffect} 2s infinite linear alternate-reverse;
  }
`
const glitchEffect = keyframes`
  ${setInterval(createAnimation, 200)}
`
function createAnimation(){
  const single = `clip: rect(${(Math.floor(Math.random() * 100 + 1))}px, 9999px, ${(Math.floor(Math.random() * 100 + 1))}px, 0);`
  return css`${single}`
}
export default function Glitch({ text }){
  return (
    <Wrapper text={text}>{text}</Wrapper>
  )
}
Glitch.propTypes = {
  text: PropTypes.string.isRequired
}
 
    