405 questions
0
votes
1
answer
23
views
Conditional rendering of multiple tables in Vue.js
I'm building a Vue.js application that requires conditional rendering of multiple tables based on certain conditions. I have a set of flags that determine which tables should be rendered, and I'm ...
0
votes
0
answers
42
views
Dynamic Form Fields Based on Selected Category in React Native
I am developing a React Native application where I need to create a form that displays different fields based on the user's selected category. I am using Formik for form handling and want to ...
0
votes
0
answers
83
views
Safari 18 rendering bug - it doesn't hide element after removing from DOM
I try to hide element from DOM, using React conditional rendering
{isShowConversationBlock && (
<div className={styles.conversationWrapper}>
<ConversationBlock
...
0
votes
1
answer
39
views
How do I activate a hidden div via a select form that is useState? [closed]
Please understand I am just learning....
can someone help modify the code so that when the ‘yes’ option is selected, a hidden part of the form is shown to allow additional completion?
I tried to do ...
-1
votes
2
answers
55
views
How to pass a component and state value in React to render conditional data based on user selection?
I am working on a React project where I have two components, UserRules (Component A) and UserEmail (Component B). I need to pass the value of a state variable selectedVoucherOption from Component A to ...
0
votes
1
answer
119
views
React: why is my conditionally rendered component not being rendered even though condition is being satisfied?
In React, have a parent component which conditionally renders the Output component based on whether there is a selected thread:
<div className="flex-grow overflow-y-auto p-4">
{...
1
vote
1
answer
30
views
Conditional Rendering of Controlled Components Giving a Blank Page When False
I've been working on my first React Project, a CV application where users can input their information and generate a CV. After the user submits the form, the form should disappear and the relevant ...
0
votes
0
answers
38
views
conditional rendering in react + firebase [duplicate]
I want my code to conditionally render some pages after authentication but the current problem I am facing is they are rendering even without authentication. A user can access the pages without ...
-1
votes
1
answer
153
views
React: How to check if a component returns anything or not ( using Javascript )
I'm using my components as below and I want to check if one of inner components is returning anything or not to make style decisions based on that.
<Grid xs={12} md={ Bar() ? 8 : 12 }>
<Foo ...
0
votes
0
answers
188
views
What is an intercepting route in Next.js?
After reading the official documentation, I still didn't understand Next.js intercepting routes.
Given:
My questions:
When we navigate to /photo/id1, do both page.js files get rendered?
When we ...
0
votes
1
answer
45
views
how to keep constant variable on react rendering
i've got stuck in react problems.
I've create an online shop (front-end) website in react
const products = [
{ id: 1, name: "Oppo", price: 200, unit: 1, img: "oppo.jpg" },
{ id:...
0
votes
0
answers
99
views
React Navigation Material Top Tabs Navigator conditional rendering blank screen on iOS
I'm experiencing this issue with my Expo React Native app on iOS only where a blank screen is displayed after swapping the Login screen with the Main screen based on simple component state change, e.g....
0
votes
0
answers
64
views
React State Update Not Reflecting Immediately in Conditional Rendering
I am working on a React component where I need to select an item from a list and update the state with the selected item's ID. I then want to conditionally render the selected item. However, I am ...
0
votes
1
answer
26
views
Conditional rendering not working for flutter widgets
Inside the build method 👇🏽
Widget build(BuildContext context) {
final provider = Provider.of<StateProvider>(context, listen: false);
// Get the selected question details from the ...
0
votes
1
answer
101
views
Next.js conditional rendering on small screens
I'm using a custom hook to render different elements on the page based on the screen size.
Hovewer during rendering there is a delay because of the useEffect hook. Elements that are rendered ...
0
votes
1
answer
38
views
Unexpected behaviour when conditionally rendering the same input component with different defaultValue
NOTE: this question aims to understand why this code gives this behaviour, not what alternative code would give the desired one.
I have a custom component to represent a particular form field, and I ...
0
votes
0
answers
72
views
Render different pages on same route but for different subdomains in a single nextjs app
I have a nextjs 14 frontend app, a python fast api backend. I have app router implemented in the app. I want to create a different website on store.myapp.in which is different from dashboard.myapp.in ...
0
votes
0
answers
504
views
how to know if the app is on the not found page in nextjs 14 app router
I'm encountering difficulty determining if my Next.js application is on the 404 not-found page within the app router. I have a functioning 404 not-found page that displays when the URL doesn't match ...
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'>
...
0
votes
3
answers
80
views
Render React child component with conditional rendering and one general wrapping html element
I have a React component:
const Options = () => {
// Option logic
if (isOptionOne) {
return <OptionOne />;
}
if (isOptionTwo) {
return <OptionTwo />;
}
if (...
0
votes
2
answers
40
views
Re-rendering conditional buttons
This is for an interactive bible.
In the following code I have buttons that are being conditionally rendered based upon the buttons I previously clicked.
The code calls an API to retrieve the data.
...
0
votes
0
answers
82
views
Media Viewer in React: Displaying Single and Multiple Images from Firebase Storage
Problem Description
I have a list of media items retrieved from Firebase Storage categorized as usersingleMedia and usermultipleMedia. The media can be a single image, a single video, or a folder ...
-1
votes
1
answer
71
views
Is component duplication for responsive display in react a good idea?
I am trying to display a component called 'BillingInfo' on my checkoutpage in react . using tailwind css.
<Checkout>
//some complex layout
//container 1
<div >
/** other ...
0
votes
0
answers
13
views
Showing the raw json data on refreshing the page
I have built a mern stack gmail clone and i have deployed the project and after the deployment when i open the link and login to my application and it logged me in very well and display the data ...
1
vote
2
answers
64
views
Conditional styling not working as intended
Creating tabs always works well in React and this is working when opening in a browser, but the 'tabActive' styling is not removed when another tab gets clicked. 'tabActive' styling is getting applied ...
0
votes
1
answer
136
views
Javascript HTML conditional display table of rows looses table column alignment
Hello HTML/Javascript experts,
I need to render large tables (few hundred rows at least) in a browser.
In order to help navigating I want to turn on and off sub sets of the rows by check buttons in ...
2
votes
1
answer
1k
views
How conditionally add an HTML attribute to an element in Astro
I am using Astro and TypeScript.
How do I add conditionally an HTML attribute rel="noreferrer" to an element in Astro?
So when targetBlank = false it doesn't render rel attribute in the dom?
...
0
votes
1
answer
126
views
Conditionally render images which are meant to serve as only background elements for body so they don't add height on pages with too little content
I have some NextJS image components to the RootLayout of a NextJS component and gave them negative z-indexes and positioned them absolutely as some content is dynamic and I wanted them to be placed in ...
0
votes
1
answer
77
views
jsx conditional rendering won't update on state change
I want to conditionally render jsx in my AuthForm component and i'm having trouble specifically with the 'isPasscodeEntry' scenario.
My AuthForm component conditionally renders an input form based on ...
3
votes
2
answers
263
views
How can i display only my Register component in my React app
I have been trying to display the register component of my react app which comprises of register forms. However, I have not been able to succeed and the youtube videos are confusing me more. ...
0
votes
1
answer
39
views
React , when you add class remove other ones
I got a total of 3 conditions. When I add the class possible-links-cont-star-btn with the x.feature condition I want to remove the all other classes element have.
<Link
key={i}
onClick={() =>...
1
vote
2
answers
861
views
Issue with Conditional Rendering in React Custom Component
I'm facing an issue with conditional rendering in a custom component in my React application. I've been working on creating a custom component for conditional rendering that renders content only when ...
0
votes
1
answer
65
views
Trying to display different value depending on other values in React
I have this conditional rendering
{livematchcard.event.status_name != "Ολοκληρώθηκε" ? "Τελικό"
: (livematchcard.event.sport_id == 4 ? (
...
0
votes
2
answers
75
views
Use both operators in conditional render React
I am trying to create a condition in order to render an error message in a React App.
This is my code {channel.length > 0 || sport.length > 0 && ref.current == true && <Error ...
0
votes
2
answers
851
views
React derived state. Whats wrong with this code
Coming from angular, i would like to know what's wrong with this code. I've been told that i should use useMemo (for the fitlering part) and useRef (to store products).
I know how to do that, but i ...
0
votes
1
answer
491
views
Conditionally render an image or a video in React
so I have a form to let the user upload an image OR a video. Both fields have a default image.
I've tried different approaches to render whatever the user uploaded (image or video), but nothing has ...
1
vote
0
answers
59
views
Conditional Rendering on BottomTab Navigator not working
So what i am trying to do is that I am doing conditional rendering of my AccountStack and AuthStack on my AccountTab, now my AuthStack contains screens Welcome, Login and Otp and after entering the ...
0
votes
1
answer
701
views
The component in Nextjs flashes in conditional rendering
I want a component to render based on token is available or not - similar to the jwt localstorage authentication.
The issue i found that whenever I refresh the page when the token is available still ...
0
votes
1
answer
43
views
What is wrong with this React conditional rendering expression?
I had the below Reactjs snippet in our UI, which works fine now.
<Select
label="Send To"
labelId="send-to-label"
...
-4
votes
1
answer
436
views
"JSX element 'div' has no corresponding closing tag." [closed]
I got an error message when I tried to run the code:
"JSX element 'div' has no corresponding closing tag."
I was trying to learn conditional loading message.
return (
<div className=&...
0
votes
1
answer
344
views
I am not getting data from api after refreshing the web page in next.js
I am working on a project, where I am using conditional rendering. I am not sure what the cause but I am not getting data from api after refreshing the page.
Image of the page on first load
Image ...
3
votes
3
answers
85
views
React: How to use conditional render and react-hooks to update another component's state?
I'm new to React. I'm trying to create a Login/Register Screen. I have three components called Login, Register and SlidingCard. I render these componenets on other jsx file called Screen. In ...
0
votes
0
answers
21
views
How to change my react webpage according to the button I am pressing on a static webpage?
I am basically creating an online game .I have set up an Express server which till now served static webpages . Now , I have static webpage which has two buttons 'Create Game' and 'Join Game'. Now, ...
0
votes
2
answers
521
views
What's the proper way to render a single element of an array in Svelte?
I have an array of nodes, which in my case are objects that have some data, including an id. I only want to display the active node, which is found by comparing the node ID with the active node ID. I ...
1
vote
1
answer
25
views
VueJS Conditional rendering with v-show and json
I'm building a portfolio with VueJs and would display projects with selected tags.
Here is my code:
<script lang="ts">
import projectsData from "../projects.json"
export ...
1
vote
0
answers
82
views
Conditional render of super index with react
I'm having a hard time trying to achieve this approach:
I have to add a super index number only in some list items depending on their ID.
What I is when product with id 198940 and 20084 both exist ...
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
/...
0
votes
1
answer
68
views
Can i render a react context this way?
Currently I have a context to return the verification status of a given user. This context is wrapping all the App.
I have one UnAuthStatusProvider:
const UnAuthStatusProvider:FC = ({ children }) =>...
0
votes
2
answers
45
views
Cannot render third react component using conditional rendering
import React, { useState } from 'react'
const LoginPage = () => {
const [isLogin, setIsLogin] = useState(true);
const [isSignUp, setIsSignUp] = useState(true);
const [isAdmin, ...
1
vote
1
answer
99
views
Is there a possible way to have conditional rendering inside of flatlist in react native?
In the below flatlist the values of event.Tr1C2 may come as undefined in response
I would like to display the whole text component only if the value is not undefined and would like to hide the ...