401 questions
0
votes
2
answers
2k
views
REACT ref.current is null in conditional rendered component
i'd like to achieve open react-datepicker calendar on button click outside of this component with ref. It is working fine if its outside of conditional rendering. If i put into a condition statementm ...
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, ...
3
votes
2
answers
4k
views
React Dynamically Import Images
In my React code, I want to display several images in my folder. I have about 100 images and I don't want to import all of the images in different import statements. I want to import them maybe with ...
-1
votes
1
answer
1k
views
iterate through tabs list and show different view with if statement
Hi so currently i am trying to iteratively build tabs and the tabpanels to show it's information but i cannot get what i want to be displayed. i have a list of names for each name create a tab and a ...
0
votes
0
answers
363
views
Conditionally render a class to a grid cell, then remove it on a state change
Ok, so first time question-asker here, but I'm having trouble rendering a class to a grid cell, then removing it. The idea is the grid is the floor, and the class represents a roomba moving around it. ...
0
votes
2
answers
1k
views
how to conditionally render a mobile nav in gatsby?
I am new to gatsby and server side rendering, although I've worked with react quite a bit before. I wrote a bit of code that checks for the window size and then renders either the nav or the mobile ...
0
votes
3
answers
215
views
Can conditional rendering in React use logical operator || when rendering the same content?
The code does the following - if the item selected from the dropdown menu is 'pinpong' then it will show the content within the div container content
In the second component if the item selected from ...
2
votes
1
answer
524
views
How to render multiple widgets in flutter according to data from a list?
I'm new to flutter. I have to render widgets according to an API response, which is JSON in a list.
This is one of the custom widgets I have written for it. I have one for every row.
Widget ...
0
votes
3
answers
4k
views
React: conditionally render an item in the menu
I'm using React with Material-UI.
I'm developing a simple UI in a form of a dropdown menu. I'd like to control the rendering of the first row with condition passed as a prop. How can I use the ...
6
votes
1
answer
2k
views
conditional rendering of the same component with different props does not unmount the component in ReactJS
I'm working on a react web application the problem that I have is that I'm doing a conditional rendering of the same component with different props but that does not unmount it then remounts it again ...
2
votes
1
answer
7k
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 ...
0
votes
1
answer
52
views
conditional rendering not acting uniformly in reactjs?
I have used conditional rendering in the past but for some reason, it's working on one element here but not on another although they are both using the same JSON phrasing and the same type of ...
0
votes
2
answers
1k
views
Custom callBack on a Modal with conditional rendering
I am building a ride sharing app to learn react-native. In order to publish a new Ride, I have a Modal which renders conditionaly on the step state and each step has a diferente UI. Like:
let screen;
...
0
votes
2
answers
749
views
Multiple Inline If-Else with Conditional Operator
Can you give me a hand with this expression . Basically what i am trying to say is
If props.row.registered is true set disabled to be true or if is props.row.registered is undefined set it to false.
&...
0
votes
1
answer
337
views
Is it possible to send a condition as prop in React?
I've been wondering if there is a way to send a condition as a prop to a child component that needs some conditional rendering and its iterating a set of dynamic objects.
Let's say I want one of those ...
2
votes
1
answer
6k
views
React Conditional Rendering using switch
I want to render a component based on props passed by the parent component, then in the children component i evaluate the props using switch statement. I was unable to get return element based on ...
1
vote
1
answer
4k
views
building a overlay fullscreen navbar in vue.js, by toggle navbar height from 0% to 100%
Trying to implement the overlay fullscreen menu with Vue.js, html/css/js is [this solution]https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_overlay2
But stuck with how to toggle div ...
4
votes
2
answers
17k
views
How to do conditional rendering according to screen width in react?
there is a problem, I don't know how to implement the component technically correctly.
I want to do conditional rendering of an element
depending on the device screen.
Example: if the screen is less ...
0
votes
3
answers
5k
views
Double conditional rendering in react?
I'm building a small clothing store app in React, just to learn things. I implemented a filter by price section but I would want to be able to write a condition for the case in which there's no item ...
0
votes
1
answer
942
views
'OnPress' non functional used in ternary operator
I am new to React Native. I am trying to render a button conditional on the value of a 'global' value. This is incredibly frustrating.
Normally it would be a simple case of using an 'if/else' ...
0
votes
1
answer
45
views
React Nested Loops and Keys
I'm trying to get a bit of react code to work and am struggling with conditional rendering. The following:
<div id="table_holder" className="table-responsive mx-3">
<table ...
2
votes
1
answer
2k
views
Display buttons dependent on variable value in React Native
I am using the following code to display a 'Home' page with a button on it in React Native...it is functional without difficulty:
import React, { useState } from 'react';
import { Button, Text, ...
1
vote
1
answer
52
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 ...
0
votes
1
answer
525
views
How to render a component onClick with a button in another component?
I'm trying to render component with an "Edit" button that is within the component. I decided to use conditional rendering in my code, but I can't seem to get it to work properly. Does anyone have ...
0
votes
1
answer
275
views
How to set conditional rendering navlink
i have two value at dataindex: isOnline (true and false) , this time my render NavLink on both true and false , but i want only render on false value not with true value. Is there any possibility to ...