score:-1
Include your CSS
or SCSS
file in specific component
Example:
// this is rule component which have rule scss file
import './assets/css/rule.scss';
class Rules extends React.Component {
}
// this is report which have report.scss file
import './assets/css/report.scss';
class Report extends React.Component {
}
Now its depend how you make structure of your component as for this example i kept all this scss file is assets
folder.
score:0
You can do it using props:
const Front = (props) => {
if(props.match.params.page === 'home'){
require("./css/bootstrap.min.css");
require("./css/style.css");
require("./css/vendors.css");
require("./css/custom.css");
}
return (
<div>
<Header />
{ props.match.params.page === 'home' ? <Login /> : null }
</div>
)
}
Source: stackoverflow.com
Related Query
- How to use different CSS files for different page with react js
- How do i use different css files for different components React with same class names
- How to use a different delay for each item with React transition group?
- how to use different IP address for development and production with react and axios
- How to config react to watch for changes in css files with npm-watch
- How to correct CSS differences for different OS in Semantic UI React? I am having issues with Form.Select in Semantic UI React
- How to Create global styles with Styled components in react and next js and is it better to use combination of css files and styled component?
- How to use same component in React multiple time but with different CSS on different pages
- How can I use react router in nested page with "exact paramater" for my this scenario?
- How to use multiple css files for react pages?
- How can i use same component multiple time in different files with different CSS
- How to use different .env files with nextjs?
- How to use vw and vh css with React Native
- How to use React Hooks Context with multiple values for Providers
- How to use React Context with useState hook to share state from different components?
- How can I use CSS @media for responsive with makeStyles on Reactjs Material UI?
- How to implement the OAuth2 Authorization code grant with PKCE for a React single page application?
- How do you use CSS grid layouts with React effectively?
- how to deal with css imports for react server-side render
- How to use different icons for each tab with createBottomTabNavigator?
- can i use the tsx extension for test files if using react with typescript
- How to use Turborepo for an existing react app created with Create React App in order to make it a monorepo?
- React Redux with redux-observable use the router to navigate to a different page after async action complete
- How can I uglify my bundle files for React with gulp?
- page title not available with jest/enzyme for testing react app, how to get the title?
- How to link to current page with different param in react router?
- How to use router for switching between components with a key value pair in react
- css - how to use grid with different number of item in a row
- How can I add multiple path for home page with react router dom 6?
- How to use Jest for testing a react component with localStorage?
More Query from same tag
- FormattedTime component throwing error when mounted in unit test
- Dynamically create React.Dispatch instances in FunctionComponents
- Styles not working in isomorphic React implementation using webpack
- File upload progress using react-dropzone
- Can I make multiple useMutation in a components
- Access parent context when using this.props.children in React
- Recharts custom label
- React using fetch returns undefined after refreshing the page
- AJAX > MongoDB query only works five times, then server stops handling requests, and I can't refresh the page
- Dynamic dropdown list react axios get request
- Cannot create property 'key' on string
- The correct way to store complex form data in React app
- React Link not working in an independant component
- React Array in State updating late
- Having troubles with react-router-dom
- Call UseFrame only when element is on view port
- How I could test location with MemoryRouter on React Router DOM v6?
- Does a React Component require Render props?
- How to open/close react-bootstrap modal programmatically?
- Conditional render Navigation
- Displaying an Array of Videos under a Product - data map slice javascript firebase collection: Data showing as empty array []
- React-redux connect method unable to locate store in props
- Styles break after increasing height of mask container
- What's an efficient way to render child items of one of many list items in React?
- ReactJs - Combine multiple style objects immutably
- How to get item index in map function
- React setState is null
- Pass props to parent component in React.js
- Reactjs npm test: Jest encountered an unexpected token
- Is it possible to put a component inside a component?