My buttons don't work in production, please help! (Gatsby, TypeScript) #382
Unanswered
Lloydinator
asked this question in
Q&A
Replies: 1 comment
-
Hey there I think you'll find you'll need to extend a styled component rather than one you've made yourself. Could you check if this works? import React, {FC, MouseEvent} from 'react'
import tw from 'twin.macro'
-const ThisButton = ({onClick, children, ...rest}: ButtonComponentProps) =>
- <button onClick={onClick} {...rest}>{children}</button>
+const ThisButton = tw.button``
export const NavButton = tw(ThisButton)`
text-black cursor-pointer text-xl leading-none px-3 py-1 border border-solid
border-transparent rounded bg-transparent block lg:hidden outline-none
focus:outline-none
` |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description and steps to reproduce
The stack for my project is GatsbyJS, TypeScript, Twin Macro (TailwindCSS), and Emotion.
In my styles.tsx file, I style and define my navbar button like this:
Now my markup file, index.tsx looks like this:
Expected result
Buttons should be clickable in production like it is in development. There should be many more event listeners on my buttons in production than just
load
.Actual result
My buttons only work in development. I see all the event listeners you'd expect such as
click
, however, in production, onlyload
is there. I don't know why and it's very hard to debug. I've tried just making the nav button into a div but it still doesn't work. The only time buttons work in my app is when I use them in forms.Environment
Beta Was this translation helpful? Give feedback.
All reactions