小弟在練習styled-components的時候,有上網查到說如果想要元件的className不是只有隨機產生的字母的話,就安裝babel-plugin-macros,但是小弟試了之後發現不起效果,想請問是否有哪邊寫錯了。
小弟的專案是用create-react-app
import React, { useEffect, useState, useRef } from 'react'
import { BrowserRouter as Router } from 'react-router-dom'
import styled from 'styled-components/macro'
function App() {
const Header = styled.header`
width: 100px;
height: 100px;
background-color: skyblue;
`
return (
<Router>
<>
<Header>123</Header>
</>
</Router>
)
}
export default App