• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: React JS: display map components as flex style in the same row

Resolved: React JS: display map components as flex style in the same row

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I am learning React js and trying to build a product page of an E-commerce website, but I am stuck with the part where I should put the map components from a data in the same row. Here is the link for my codes.
https://codesandbox.io/s/serene-glade-dvps24?file=/src/Shop.scss
What I want is to put three products in a row, but it seems like if you map an item the whole wrappers will be duplicated since they are map components. Any helps would be appreciated, thank you.

Answer:

You need to move the wrapper outside the map. I usually set the wrapper styling to display: grid; Check my changes: https://codesandbox.io/s/upbeat-voice-pf8pst?file=/src/App.js

If you have better answer, please add a comment about this, thank you!

html javascript reactjs sass
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to separate multiple answers in one column, for multiple columns, by creating extra columns

26/03/2023

Resolved: How to set consistent decimal separators in R data frame?

26/03/2023

Resolved: How to resolve LNK2001 in c++ projects

26/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.