Getting undefined when importing svg as ReactComponent in create-react-app project

前端 未结 5 1061
礼貌的吻别
礼貌的吻别 2021-02-18 18:56

I\'m getting following error when trying to load svg as ReactComponent.

Element type is invalid: expected a string (for built-in components) or a class/fu

5条回答
  •  耶瑟儿~
    2021-02-18 19:28

    Try to use Styled components

    import Logo from 'assets/logo.svg';
    
    const Image = styled.img`
    
    const LogoWrapper = styled(Image)`
    transition: all 0.25s linear;
    &: hover {
        transform: scale(1.25);
    }`;
    
    
    

    This one is working er

提交回复
热议问题