首页 > 其他分享 >Next.js & styled-components All In One

Next.js & styled-components All In One

时间:2022-12-02 00:55:44浏览次数:109  
标签:components styled js https xgqfrms Next com

Next.js & styled-components All In One

styled-components

$ npm i -S styled-components

$ yarn add styled-components

https://styled-components.com/

https://github.com/styled-components

https://github.com/styled-components/babel-plugin-styled-components

demos

https://nextjs.org/docs/api-reference/next/link#if-the-route-has-dynamic-segments

import Link from 'next/link'
import styled from 'styled-components'

// This creates a custom component that wraps an <a> tag
const RedLink = styled.a`
  color: red;
`

function NavLink({ href, name }) {
  return (
    <Link href={href} passHref legacyBehavior>
      <RedLink>{name}</RedLink>
    </Link>
  )
}

export default NavLink

(

标签:components,styled,js,https,xgqfrms,Next,com
From: https://www.cnblogs.com/xgqfrms/p/16943239.html

相关文章