Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
57 views

Input element is not displaying

In my React app, I am trying to create logic for how my input elements should be displayed. I used the window.innerWidth for different screen sizes, as is seen below: <div className='Trends'> ...
Anthony Onah's user avatar
0 votes
1 answer
149 views

Why is react-nestable rendering [object Object] instead of expected JSX?

I am trying to render custom JSX snippets based on the objects stored in an array in using react nestable. But instead of the JSX snippet, [object Object] gets rendered on the screen. Here is my code /...
Siddhartha Sahu's user avatar
1 vote
2 answers
2k views

How do I use ternary operator for classnames with css modules?

I am facing some difficulty effecting a styling with the ternary operator in an element's className. I created three buttons to render to a particular component when any of them are clicked, and I ...
Edozie's user avatar
  • 13
0 votes
3 answers
2k views

NavLink returns active to all links and no solution in SO seems to work

It seems none of the solutions presented elsewhere works, so I decided to ask. No matter what I do, I can't get the NavLinks to be rendered differently if they are active or not. I took the ternary ...
Fred Barros's user avatar
1 vote
1 answer
636 views

How do I conditionally render part of my CSS class

How can I make all of the css inside the following hover psuedoclass conditionally render when a variable (data) is not null? I have the following styles in my React Component (which uses Material UI ...
Katie7's user avatar
  • 879
1 vote
1 answer
276 views

Why CSS pulse animation is not working without any errors?

codeSandbox link 'expense' and 'income' are two states with initial value of 0. The expense container amount required to be highlighted with pulse animation when the expense amount is greater than ...
vInEnDeRsInGh's user avatar
1 vote
0 answers
236 views

Animating conditionally rendered components in React

I have a functional component that renders a div X or a divY depending if the props are undefined or not. Functional Component: const InfoHeader = (props) => { const {population, infected, ...
Jorge Guerreiro's user avatar
1 vote
1 answer
6k views

How to conditionally render css with clsx?

I have a button component that's supposed to change colors based on its status (passed in by props). The colors are stored in a css file. I read that the clsx npm is a good one to use, but I don't ...
for-84's user avatar
  • 11
0 votes
1 answer
663 views

Show horizontal line only when condition runs for second time in Reactjs

I am trying to show the horizontal line <hr> tag, when the conditions render for second time. For example, When the data renders first time, I dont want the <hr> tag, but as it renders the ...
Singh's user avatar
  • 207
1 vote
1 answer
45 views

Trying to figure out how to change background image depending on the genre of that particular book REACT

*I am currently trying to figure out how to change the background image of my book--container--fiction. I have three different images and depending on the genre of the book I would like to change ...
webDesigner's user avatar
22 votes
2 answers
25k views

React JS: How to animate conditionally rendered components?

Example is a functional component in which I am rendering a div conditionally. I want this div to fade-in when rendered conditionally and fade-out vice versa. For that, I have maintained two local ...
Vinay Sharma's user avatar
  • 3,737
0 votes
1 answer
313 views

Conditional rendering - show div based on user select

I have a select dropdown and want to use the value to decide if a div is shown via v-if. <select class="custom-select custom-select-sm" id="lang"> <option value="1">English</option&...
user12978902's user avatar
-1 votes
2 answers
511 views

Dynamically and conditionaly changing css of a button in reactJs

In a react application how to dynamically change css of a button when a form input validation fails(There are lot of input fields which accept marks)
vibhuti's user avatar
1 vote
3 answers
1k views

React: Conditional rendering CSS classes with Animate on Scroll library

I'm using the Animate on Scroll library and React-Bootstrap for a project. Using the following code applies the animation: <Row> <Col xs={{span: 12}} md={{span: 8,...
Nick Kinlen's user avatar
  • 1,406