Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

66
Views
Using hooks inside createGlobalStyle

Hey I am trying to use hooks inside styled-components - createGlobalStyle. I know that this is not possible, because createGlobalStyle is a function and neither a component nor a custom hook. Maybe someone knows a workaround or a solution :).

export const GlobalStyle = createGlobalStyle`
 p {
   padding: ${p => useMediaQuery('min-width(768px)') && 12px};
 }    
`
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

One workaround can be to add a media query hook anywhere in your code, catch the screen size, send value in props (prop drilling, context Api, redux) to make your styled components adapt to your screen.

You may go through this link

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!