2

Right now, I figure out that I have two way to do this: One , I am putting global style such as in the App.css and then import them in the App.js

:root {
    box-sizing: border-box;

    font-size: 62.5%;
}

*,
::before,
::after {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
}

Another way is to use GlobalStyles that provide by styled Component. Which way should I do ?

Thanks for the help!

1 Answer 1

1

If you using a library you should stick to its API.

Meaning using createGlobalStyle.

A helper function to generate a special StyledComponent that handles global styles.

In more advanced use cases (like having a theme) your only option to alter the global styles will be using the pre defined API.

As a side note, you can do it in more than two ways (BUT DONT DO IT), like querying the DOM and editing the style.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.