Kevin Powell - CommunityKP-C
Kevin Powell - Community16mo ago
18 replies
Jonah

Problem with the container background

I'm using a ternary operator, and transparent is not working, but "#343964" is working. I was able to hide the content of the container, but not the background.

import React from "react";
import Questions from "./Questions";
import QuizResults from "./QuizResults";

export default function Main({ isQuizCompleted }) {
    
    return (
        <div className="container" style={{
            backgroundColor: isQuizCompleted ? 'transparent' : '#343964'}}>
            {/* Only render Questions if the quiz is not completed */}
            {!isQuizCompleted && <Questions />}
            
            {/* Render QuizResults when the quiz is completed */}
            <QuizResults isQuizCompleted={isQuizCompleted} />
        </div>
    );
}
Screenshot_2024-10-01_130734.png
Screenshot_2024-10-01_130828.png
Was this page helpful?