Media query syntax for Reactjs

Posted by Andre Scott | Updated on

Media query syntax for Reactjs. You cannot set media queries inline. You will need to create a separate CSS stylesheet and then import the stylesheet.

So the following code would go in a new styles.css file for example.

Then you can import your new CSS styles file into your react file. For example, you could add import ‘./styles.css’ to the top of your App.jsx file (assuming they are both at the root level), or you could import it directly into a specific react component file.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers