Implementing CSS in ReactJS using the stylesheet approach

I have been attempting to apply CSS styling in my app.js file, but for some reason, the color of the h1 heading "Todo Manager" is not changing as expected.

This is what my app.js file looks like:

import './App.css';
import Stylesheet from './MyComponents/Stylesheet';

const App = () => {
  return (
    <div className='App'>
      <Stylesheet primary={true}/>
    </div>
  );
}

export default App;

Contents of myStyles.css file:

.primary {
  color: 'orange';
}
.font-xl {
  font-size: 72px;
}

Code snippet from Stylesheet.js file:

import React from 'react'
import "./myStyles.css"

function Stylesheet(props) {
  let className = props.primary ? 'primary' : ''
  return (
    <div>
      <h1 className={ `${className} font-xl` }>Todo Manager</h1><br /><br /><br />
    </div>
  )
}

export default Stylesheet

Answer №1

Modify the value of the color attribute from 'orange' to orange, without using quotation marks.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What's the most effective way to refresh a list in ReactJS after a new item has been added to it?

Imagine I am developing a task management app using React, where users can log in, create their own to-do lists, and perform CRUD operations on them. I have come up with two different approaches: When accessing the page with the to-do list component, ...

Excessive content spills off the page (React)

I am new to React and want to create a page that grows and becomes scrollable as the container expands. However, currently the container is overflowing at the top, even though I can scroll to see the bottom part. Check out this link for reference In the ...

What is the most effective method for importing .module.scss classes in a React project?

In the midst of my NextJs project, I have encountered two different methods for importing CSS classes from a .module.scss file. Method 1: import * as styles from './page.module.scss'; Classes are used like this: <div className={styles.myCla ...

How to choose an option from a ReactJS dropdown using Selenium in Java

I am currently working with a ReactJS front end application that features a dropdown box. When this dropdown box is clicked, it displays elements inside of it and requires the user to select checkbox(es). However, when attempting to inspect the values with ...

Manage the number of items in each column using flexbox or grid layout strategy

Here's a similar situation .items { width: 100%; display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; background: #cecece; padding: 10px; margin: 20px; } .item { height: 100%; flex: 0 0 calc(50% ...

Unexpected background image slideshow appearance

I am encountering an issue with my slideshow where the last image briefly appears before the first image loads in a continuous loop. The offset of the initial image causes it to start at the middle of the window, and in Google Chrome and Safari, subsequent ...

How can a single word be highlighted within a paragraph without adding any extra elements?

<p>Next word is bold</p><strong><p>Bold</p></strong> but the paragraphs are separated how can they be combined like this "Next Word Is Bold Bold" using JavaScript? ...

What is preventing me from utilizing react.createContext()?

Hey there, I've been working on integrating the react context api into my project. I followed the steps outlined in this guide: Unfortunately, when I tried to display some of the information, an error occurred. Here is the error message from my cons ...

What causes the issue of JavaScript code not loading when injected into a Bootstrap 4 Modal?

I've created a JavaScript function that triggers the opening of a Bootstrap Modal Dialog: function displayModal(message, headerMessage, sticky, noFooter){ var modal = $('<div />', { class: 'modal fade hide ...

Implementing Object Value Assignment to an Element Using jQuery

I recently received a set of data via an API request: https://i.stack.imgur.com/YGe2D.jpg In order to display this data as selectable options, I included the following code snippet in my AJAX script: $.each($(value.routes), function(index, route){ $ ...

Tracking lengthy calculations in HTML using JavaScript is a breeze with this straightforward method

Need assistance with updating HTML page during a long loop process. var updateLog = document.getElementById("log"); for (count = 2; (count < 10000 && calculatedPower < power); count = count * 2) { calculatedPower = calculate_power(count, w, df, de ...

Heroku is unable to locate a module

Currently, I am in the process of creating a web application using meteor and Heroku. Interestingly, when testing my code locally, everything runs smoothly without any issues. However, once I proceed to deploy it on Heroku, I encounter the following errors ...

Helping React and MUI components become mobile responsive - Seeking guidance to make it happen

My React component uses Material-UI (MUI) and I'm working on making it mobile responsive. Here's how it looks currently: https://i.sstatic.net/kxsSD.png But this is the look I want to achieve: https://i.sstatic.net/kJC2m.png Below is the code ...

Guide to obscuring all instances of a particular subsequence within a <p> tag

I am currently developing a project in Angular that showcases short texts. Within these texts, I aim to blur out specific substrings every time they appear. For example: Tomorrow I will have to go to London. Tomorrow is the day it will happen. My only hop ...

Learn the steps to achieve the following outcome with Bootstrap 4

After experimenting with progress bars, I found that the problem lies in displaying the remaining part of the progress bar. https://i.sstatic.net/S35jd.png For instance, when I specify a width for the progress bar, the remaining percentage appears as gra ...

Discovering elements that are shallower than a chosen selector

I'm currently developing a jQuery plugin designed to facilitate the management of form collections. This plugin is intended to incorporate buttons for adding, removing, moving up, and moving down within the collection. In every collection's r ...

divide a JSON list

Within this JSON array, there is a plethora of person data, each with their own specified type such as "hr" or "accounting". The structure of the JSON array is depicted below: { "0": { "id": "2", "name": "blabla", "type": "hr" ...

Tips for dynamically adding an external SVG animation to your website:

When trying to insert an animated SVG using jQuery or plain JavaScript, they appear static in Chrome and Edge, but display correctly in Firefox: $(".loader").prepend("<svg><use xlink:href='/images/icons.svg#loading-ring'></use> ...

Improve the parallax effect in your React component

Do you have any tips on smoothing out the scrolling animation for a React component with a simple parallax effect? I tried using requestAnimationFrame() in vanilla JS, but it doesn't seem to work well within the React component's rendering cycle. ...

Troubleshooting IE Issues with HTML5 Video Background

When creating a webpage with a video background, I include the following code: position: fixed; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; background: url(images/bg/home.jpg) no-repeat; background-size: cover; This code works well on ...