When attempting to make my styles responsive, I found that they broke due to duplicate classes on the landing page I was creating with next.js and styled components

Something strange is unfolding, and I find myself confused about the overall situation. Let me try to explain it the best I can.

On my landing page, there are three different components:

const Home = () => {
  return (
    <>
      <Head>
        <title>CosturerĂ­a Gloria</title>
      </Head>

      {/* Presentation */}
      <Presentation />
      {/* Description */}
      <Description />
      {/* Types of works */}
      <DifferentWorks />
    </>
  );
};

export default Home;

Below are the styles for the first two components (the third one is not relevant!)

(You may not need to go through all the styles, but they are there just in case!)

Presentation:

(styles for Presentation component)

Description:

(styles for Description component)

As I attempted to make the components responsive, the presentation component appeared fine, while the description component had some issues.

This is how the presentation appears:

https://i.sstatic.net/dbGyz.png

And this is how the description looks:

https://i.sstatic.net/fPmML.png

However, the description component looks skewed when I tried to make the screen smaller:

https://i.sstatic.net/AAGye.png

Upon inspecting the classes of each component in Chrome DevTools, I noticed some anomalies. The presentation component has the correct class name 'presentation,' but the description component also carries the class 'Presentation,' even though it should have its own distinct class. Furthermore, the third component, Description, has the class 'Description' but lacks any associated items. This issue has occurred before. I am puzzled by this behavior. Can someone shed light on why this is happening?

Thank you for your attention!

Answer â„–1

Still unsure about the main issue, but I have made a discovery

Your component may look like this


return (
<>
...Component's stuff..
</>
)

You should change it to this

return (
<div>
...Component's stuff..
</div>
)

I believe this works because it separates the component from others, avoiding confusion by making each component unique with its own div tag. This isolation allows your component to stand out individually

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

An issue arises in Node.js and MongoDB where data is being returned from the previous update instead of the most

Currently, I'm delving into the world of Node.js and creating a platform where individuals can vote on different items and view the results afterward. The voting process involves utilizing the /coffeeorwater POST route, which then redirects to the /re ...

Encountering a 403 error when attempting to upload files to Google Cloud Storage (GCS) using Signed URLs

The main aim is to create a signed URL in the api/fileupload.js file for uploading the file to GCS. Then, retrieve the signed URL from the Nextjs server through the nextjs API at localhost://3000/api/fileupload. Finally, use the generated signed URL to upl ...

Unable to adjust the width of the react-select component

I've been struggling to adjust the width of the select element but no matter what I try, it remains at a default width of about 75px. const CustomContainer = styled('div')` width: 100%; height: 100%; display: flex; flex-flow: row wr ...

What is the process for creating a list using layers that are published in Geoserver?

I am currently working on developing a webmapping application. One of the tasks I need to accomplish is parsing the WMS request in order to retrieve the title of each layer within the layers section: var xhr = new XMLHttpRequest(); xhr.open(' ...

HTML5 - Pictograms and Visual Elements

I'm having an issue with Font Awesome displaying a symbol as a box instead of what I want. Can anyone provide assistance? Thank you <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Home< ...

Tips for implementing a hover effect on the background color of a Bootstrap navbar

I am having trouble changing the background color of links and social media icons when hovering over them. I've tried multiple solutions found through searching, but none seem to work for me. Could someone please assist me with this issue? Thank you! ...

Passing props to child components in Next.js: A step-by-step guide

I am currently working with my index.js page, which incorporates a layout component: import Layout from "../components/layout"; export default function Home({posts}) { console.log(posts) return ( <Layout posts={posts}> & ...

Working with Ruby on Rails by editing a section of embedded Ruby code in a .js.erb file

Currently, I am in the process of developing a single-page website and have successfully implemented ajax loading of templates to insert into the main content section. However, I am encountering difficulties when trying to do this with multiple templates u ...

Fixing an erroneous value that has been dragged into the drop function with Jquery

I am encountering an issue with my codes and need some assistance in identifying the problem. The data is being dynamically loaded from the database, and I am using a foreach loop to display all items in a draggable div. The issue arises when I drag an it ...

Error Encountered in Jhipster Application During Initial Launch

Struggling with running a newly generated Jshipster 3 application using gulp serve after successful generation. My setup includes Ubuntu 16.04 and npm 3.9, but I keep encountering an error when attempting to execute gulp serve: check out this screenshot ...

Data isn't being sent to Firebase due to a failure in triggering the Stripe webhook

I've been struggling to get my webhook working properly with Firebase for handling Stripe purchases. Despite trying to implement try/catch statements, I can't seem to figure out why the error is not being caught. I'm utilizing NextJS backen ...

Issue with Three.js: The mouse hover effect does not revert back to the previous color

Currently, I am working on creating a pattern using Three.js. The goal is to change the color of a face to gray when the user hovers over it with the mouse, and then revert it back to its original light blue color when the mouse moves away. Unfortunately, ...

Next.js router query not returning the expected value

Upon initial loading of the Edit page, I encountered an issue where the query was returning as 'undefined' instead of the expected result. It's important to note that I am employing client-side fetching and not utilizing SSG or SSR. The &apo ...

Creating a dynamic table in AngularJS with rotating values for rows and columns

I am seeking assistance in creating a table with a custom number of rows and columns. The table should have two input fields for specifying the number of rows and columns, and upon submission, the table should dynamically adjust to display the specified nu ...

Utilize VUE NPM to add imported packages to all remaining files

I am using a Vue 3 npm app and I have installed the jQuery package to use it. Currently, in order to use jQuery, I need to import it like this: import $ from "jquery"; Although this method works, I find it cumbersome as I have to include this im ...

What is the best method for establishing the default value on a language changer that corresponds with the current locale

I am currently facing an issue with setting the "defaulValue" of a Language selector to show the locale it is in. ** Please note: I am working with Nextjs and TailwindCSS This is what my code looks like: import React from 'react' import { useRo ...

Prevent form submission without JavaScript

While the issue is easy to grasp, it poses a challenge in implementation. I am encountering clients who disable their browser's Javascript by default, causing complications on my website. This is because my website sends ajax requests upon form submis ...

Encountered an issue retrieving audio during recording with Recorder.js

I've come across a scenario where I'm utilizing the Recorder.js Demo for recording audio. Interestingly, it works perfectly on Linux but encounters an issue when used on Windows. A pop-up alert stating "Error getting audio" shows up. Here's ...

How to pass the ng-repeat $index value as a parameter in AngularJS

Within the code snippet provided, there is a shell page index.html and a partial view currently utilized by two different controllers. The static data in AppController is connected to the list.html partial view and displayed as a table. In the JavaScript p ...

Send form data when opening a fresh page with Javascript

In the WordPress build for our company, there is a need to transfer data when previewing a page. To streamline this process, my boss wants to override the default functionality of the preview button by opening a new tab and passing the necessary data throu ...