score:0
Accepted answer
importing your css at all is applying it right away.
you'd probably be better off if you arranged your css in such a way that you could conditionally apply a single class to a parent element that would then apply styles from nightlight.css
.
e.g. inside nightlight.css
.night button {
/* styles for your buttons when they're in a night container */
}
.night p {
/* styles for your ps when they're in a night container */
}
etc
and then have some code in your component to either add or remove the night
class depending on whether or not darkmode is enabled.
Source: stackoverflow.com
Related Query
- Not able to import multiple css without applying in React App
- Not able to import css files in react
- Unable to import multiple CSS file in react app
- How can I import local Bootstrap CSS into a React app without overriding my CSS files?
- CSS 100% height not working in React app
- React : CSS class name import not working
- create react app not loading css background images in dev or build
- Some CSS loaded into React app are not applied
- Why is my CSS not applying to my React components?
- How to deploy a react app to mutiple environments without multiple builds?
- React - responsive app - better to hide element in component via CSS or not render it
- Import CSS in a react app
- React | Multiple Context | Not able to consume default values
- Import styles css into a react js app
- Why CSS file is not loaded in the react app
- react css class not applying
- Not to able to get `props` in react js - next js app
- How to manage React Js to multiple page app not using routes?
- React not applying css styles
- React App with css module multiple classes
- Tailwind CSS classes not updating after initial build of react app
- Why can NGINX not load my react app with the right css & js files
- Cannot import from public folder in CSS Create React App
- CSS file is applying on another react component even without importing
- Tailwind CSS does not work with React App
- I am not able to install create react app on my m1 macbook pro
- not able to filter array to get movies on react app
- react - not able to import object from another js file
- Css class is not implemented in the React App using Props
- Conditionally applying css not working in React JS using Typescript
More Query from same tag
- React: How do I prevent the usage of useRef and useState to keep track of a same value in order to prevent useEffect from triggering?
- No able to display image using a variable
- Override component toString method in reactjs
- TypeError: Cannot read property 'name' of undefined inside React component used as child inside another parent component
- Why useMemo does't memoizes value
- ReactJS align material-ui elements horizontally
- React not rendering correctly layout after redirect
- Cannot read property ‘params’ of undefined (React Router 4)
- the usestate hook is not working in react
- setState in React not giving desired output
- Redirect after success async action with createAsyncThunk
- Regex for checking if a string should not contain certain words but those words are ok if they have a 'to' or 'for' preceeding the words
- Property history does not exist
- react warning cannot set state when using promises
- Unable to get the input from a textfield in React
- How to create a dynamic dropdown list from a db query?
- How to add environment variables to AWS amplify?
- React - Dynamically set state without hardcoding key field
- Put the `response.data` value into the `setState[]` array
- react-bootstrap-table-next with mobx store doesn't render changes
- Enzyme not shallow rendering child
- Seeing a blank page on deploying create-react-app application to heroku
- React form submit and "can't perform state update on an unmounted component"?
- React how to test function called in FileReader onload function
- Is there a better way to handle window properties & child components in React/Redux?
- Debounce doesn't trigger function
- My redirect is not working in class compoent?
- How to change img src onmouseover in ReactJs
- Items fetched from api not shown in dropdown react-select
- Getting "TypeError: Cannot read property 'classList' of null" on my React project with useEffect when trying to access a script?