Question about styled-components #571
-
Hello good afternoon. Sorry for my English. I didn't find it in the documentation, and in some examples I see out there, they end up resulting in a syntax or typing error. I'm experimenting on nextjs, everything is set up fine (I think). Example: Example: import tw from 'twin.macro'
import styled from 'styled-components'
export const App = styled.div`
${tw`flex justify-center items-center h-screen`}
` I see many articles about importing "styled" straight from the "twin.macro" module but apparently I didn't find anything inside. Maybe they've removed it, or need something else I don't know yet. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
You can import styled but may run into some issues - the safe way is to import Here's how I'd change your example: import tw, { styled } from 'twin.macro'
export const App = tw.div`flex justify-center items-center h-screen` The styled import works great in the following typescript twin examples, could you let me know where you saw the broken implementation of styled? |
Beta Was this translation helpful? Give feedback.
-
I've recently hit some issue with the types/twin.d.ts I'm using headless ui so I had to extend the
to support as={Fragment} but it introduces ts error on all Headless ui components (<Menu.Button>, <Dialog.Title> etc) with as property |
Beta Was this translation helpful? Give feedback.
You can import styled but may run into some issues - the safe way is to import
styled
through twin.Here's how I'd change your example:
The styled import works great in the following typescript twin examples, could you let me know where you saw the broken implementation of styled?