Utilizing the React.js Bootstrap grid system

I've been diving into React, but I'm facing an issue with the bootstrap grid/reactstrap. Instead of getting horizontal columns as expected when using the grid system, I seem to be stuck with a vertical layout.

Film.js

import React from "react";
import logo from "./ghibli.png";
import { Container, Row, Col } from "reactstrap";
import { Card, CardImg, CardText, CardBody,
  CardTitle, CardSubtitle, Button } from 'reactstrap';

const Films = props => (
  <Container>
    <Row>
      <Col md= "3">
      <Card>
        <CardImg top width="100%" src={logo} alt="Card image cap" />
        <CardBody>
          <CardTitle>{props.title}</CardTitle>
          <CardSubtitle>{props.director}</CardSubtitle>
          <CardText>{props.description}</CardText>
          <Button>Button</Button>
        </CardBody>
      </Card>
      </Col>
    </Row>
  </Container>
);

export default Films;

Answer №1

At the moment, there is only one column (col) in a row.

When you add more than one column to a row, they will appear next to each other, horizontally.

Although I am not familiar with reactjs, it seems like the code below could potentially create two columns in a row:

const Films = props => (
<Container>
    <Row>
        <Col md= "3">
            <Card>
                <CardImg top width="100%" src={logo} alt="Card image cap" />
                <CardBody>
                    <CardTitle>{props.title}</CardTitle>
                    <CardSubtitle>{props.director}</CardSubtitle>
                    <CardText>{props.description}</CardText>
                    <Button>Button</Button>
                </CardBody>
            </Card>
        </Col>
        <Col md= "3">
            <Card>
                <CardImg top width="100%" src={logo} alt="Card image cap" />
                <CardBody>
                    <CardTitle>{props.title}</CardTitle>
                    <CardSubtitle>{props.director}</CardSubtitle>
                    <CardText>{props.description}</CardText>
                    <Button>Button</Button>
                </CardBody>
            </Card>
        </Col>
    </Row>
</Container>
);

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 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 ...

Using AngularJS and the ng-show directive, you can set a <div> element to

Objective: My aim is to show the content of a div according to the status of checkboxes, while also ensuring that these divs are visible by default If I have this code snippet: <html> <head> <script src="https://ajax.googleapis.com/ajax/li ...

Guidelines for incorporating role-based permissions in a React application

I am developing a MERN application that has various features catering to different roles. I need the ability to display specific data, navigation options, and divs based on the user's role while hiding these elements from others. It is important to no ...

splitting lengthy words into several lines

Does anyone know how to break words like the examples below using CSS or jQuery? SAMPLE 1 ConfigTechnologyHormonyAppComponentBackOfficeLaunch It needs to be broken into ConfigTechnologyHo rmonyAppComponentB ackOfficeLaunch SAMPLE 2 WorkAppComponentBa ...

What is the best way to implement a custom SVG icon within the Vuetify v-icon component?

Is it possible to utilize the v-icon component in Vuetify to display a custom icon that has been defined as an SVG in a file named my-icon.svg? This SVG file is located within the public/img directory of my project. How can I reference this file inside t ...

Expand the dimensions of the bootstrap navigation bar

Is there a way to expand the Bootstrap nav bar to fill the entire screen? Currently, it only occupies half the screen in desktop view, but it is working fine in mobile optimization. <body> <nav class="navbar navbar-expand-lg navbar-light bg-lig ...

Modify the parent's style in CSS based on the presence of certain specified children

I'm working with an HTML element that can contain a child with the ID 'slideshow' <div id='content'> <div id='slideshow'> </div> </div> Alternatively, it could have a different child like t ...

Experiencing issues with the redirect button on the navigation bar of my website

Video: https://youtu.be/aOtayR8LOuc It is essential that when I click a button on my navigation bar, it will navigate to the correct page. However, since the same nav bar is present on each page, it sometimes tries to redirect to the current page multiple ...

Wrapbootstrap offers dynamic design options for Java-based web applications

I recently obtained a bootstrap theme from the website wrapbootstrap to use in my Java web application. However, I am unsure of where to begin with it. Despite having already added the bootstrap css to my application, I now wish to remove it and replace it ...

React NPM's inefficiency is evident in the complexity of regular expressions used in the

https://i.sstatic.net/XG4Vx.jpg I have spent a considerable amount of time researching this problem. Unfortunately, I have been unable to identify which library this issue is related to. Could someone please provide guidance on how to resolve it? Any assi ...

When the page height is altered in real-time, it prompts a scroll event

When a slider on the page automatically switches slides and changes its height, it causes a scroll event to trigger unexpectedly. I want to modify the scroll event so that it only activates when the user physically interacts with the page by scrolling, r ...

Concealing search components using JavaScript

I'm looking to hide elements that appear below the search field in the example code below. The code is sourced from W3: https://www.w3schools.com/howto/howto_js_filter_lists.asp. I only want the search elements to display when a user starts typing in ...

Leveraging React version 15 within Piral

The application currently in production utilizes React 15 and upgrading to the latest version, React 16, is not an immediate option. Looking ahead, I plan to incorporate piral as a whole, however, piral requires React 16 and I am unsure how to integrate R ...

How to differentiate between two arrays in ReactJS

Can someone help me with this code in reactjs? Here is the link to it: http://codepen.io/fernandooj/pen/MJOodr 1- I have an array that I am mapping, and for each item, I am sending a checkbox 2- There is another array that I still need to define 3- I want ...

Creating a counter for a list using CSS

I am attempting to utilize the counter increment feature in CSS for my ordered list, but it doesn't seem to be functioning properly. Here is the desired format I want to achieve: 1. Acknowledgements 1.1 blah, blah .... 1.2 blah, blah .... 1 ...

Audio transition on hover over image

I'm currently designing a website and I have an image depicting a house with windows. I would like to create an interactive element where the face of Goldilocks pops up in one of the windows on mouseover, accompanied by sound. I envision the face movi ...

Using @at-root seems to be causing an error when combining the "a" selector with

I encountered an issue when attempting to use @at-root and Interpolation in my Sass code. Despite using a standard example for testing, I still receive an error: .button { @at-root a#{&} { color: green; } } Error sass/Site.scss (Line 28 of s ...

Searching for information about a logged-in user's data through Graphql and AWS Cognito

I have been working on querying a user's specific data using AWS Cognito, Appsync, and Graphql. After updating my Schema rules to include @auth, I encountered an unauthorized error when trying to fetch the data. Previously, without @auth, I was able t ...

Enhancing Fullpage.js with a custom scroll delay feature

One issue I'm having is with a fading div "box" using ".fp-viewing" as a trigger for the transition effect. The problem arises when the page begins scrolling upon .fp-viewing being activated, causing the box to scroll out of view before its animation ...

Using React Admin's SelectInput within a modal window

For my React Admin project, I have a specific requirement. I need to customize the selectInput component in an edit screen to display choices in a popup instead of a drop-down list. When the input is clicked, I want a popup to appear, and I am unsure how ...