401 questions
1
vote
0
answers
149
views
How to prevent the flash of conditional rendering?
I have a register/login page where i check for the user id in the redux state, after a successful login or register , the NotFound component flashes before redirecting to the home page.
login page
...
-1
votes
1
answer
950
views
Render a component only when a state array is not empty (React Router 6)
I am dealing with search parameters and redirecting of URLs in a not so pretty way (only way I could come up with). And, because of the first useEffect right under handleSubmit(), there are way too ...
0
votes
2
answers
131
views
Add conditional rendering logic inside React child ui component or inside parent component
I am using Atomic design to structure my React components.
A certain ui child component (an atom) should be shown or not based on a value (prop).
Is it a better practice to add the conditional ...
0
votes
1
answer
443
views
conditional render of navbar based on whether user is signed in on AWS amplify
I am attempting to conditionally render a and based on whether or not a user is signed in or not using AWS amplify and Vue 3 for the frontend. I have been able to get it to not render and then ...
-2
votes
1
answer
63
views
Conditionally rendering a div with React
I want to render a div conditionally based on user input in a form.
The user enters a value between 0 - 100 and i have to render the 1 out of 3 divs, based on the value (0 -30, 30-60, 60-100).
...
0
votes
0
answers
19
views
im displaying individual product details by making an api call, all the product data is rendering correctly, except a sub array of imgs while mapping
const proId = useParams();
const ProductId = proId.id;
const [proData, setProData] = useState({})
useEffect(() => {
axios.get(`https://dummyjson.com/products/${ProductId}`)
...
0
votes
1
answer
140
views
Why I'm getting a warning about "expected server HTML to contain a matching tag" during hydration?
I'm having a hard time understanding why I get an hydration error in my server. I tried using the legacy behaviour of the Link component, but nothing works. I also get this error:
Warning: Expected ...
-1
votes
2
answers
57
views
Why My ternery operator is having the Opposite effect?
i have been trying to get my ternery operator to work on a nested fashion on the link component of the router. appearently the ternery operator is flipped where its supposed to be like
Condition?true:...
-2
votes
1
answer
387
views
How to display Card data in a modal menu react.js 2022 - 2023
I have card mapped with data from an "json" file and want the same details on the card to display on the modal menu
In the code snippet is the code for the cards that are displayed and the ...
0
votes
1
answer
35
views
useState() for conditional styles
I am new to react and working on a project and was wondering how to change the theme of a single Footer component conditionally. Attached are the two themes I am trying to render. Here is the code I ...
0
votes
1
answer
222
views
react native in line conditional rendering null value
I want to conditionally render the make call button inline based on null value. If the Button makeCall() has a null value. I do not want it to display. If it has a string value then i want the button ...
0
votes
2
answers
493
views
how to call different function based on condition with different button name? its angular related problem
<button type="button" class="btn btn-primary ms-4" (click)="update()">Save</button>
<button type="button" class="btn btn-primary ms-4&...
2
votes
1
answer
435
views
Don't build blind branches in JSX - React
So I read a book about react tips and tricks lately and it says
// 🔴 Avoid: all the JSX written here will get compiled
// even though it is on the false branch
const Component1 = ({ isLoggedIn }) =&...
0
votes
1
answer
664
views
Re-render a rendered component with async Fetch called by Callback button Reactjs
I'm new in react and I'm creating an application that has the purpose of performing calculations to make cryptocurrencies strategies, the thing is that, I already have the programmed API but I need ...
0
votes
1
answer
600
views
VueJs - Dropdown list
Hello I'm doing a dropdown in my website and I'm really new in Vue. I'm using conditional rendering for display some cards. Something like: Cars, Motos, Bikes. When i click on Cars there is a dropdown ...
0
votes
2
answers
417
views
How to display different button on different component while mapping through a common component in React?
I have created a component which basically generates a card which includes card title,card description and a button. Now when I map through an array on a different component to generate those cards I ...
1
vote
1
answer
243
views
Is there a way I can conditionally render a value in a table if it is not undefined?
I am currently trying to develop a table dashboard for a list of properties for the owner to see. And the issue that I'm having is that when I'm trying to display the tenant information, some of the ...
0
votes
0
answers
57
views
Conditionally rendering components, but code is bloated with booleans and states, is there more efficient way?
I'm refactoring my code as it was bloated with multiple if else statements & states.
My issue is the use of states & conditionally rendering. I've only been using boolean states to determine ...
0
votes
1
answer
839
views
Unsure as to why conditional rendering is not working in react
I'm trying to have something conditionally rendered based on the length of the array I receive from the backend which contain objects. If the length is 0, then I want it to say something like "no ...
2
votes
1
answer
1k
views
How do I use like & unlike functionality on every element while using map to render those elements?
I have social media posts stored in firebase and each post has a like button. I am using map() function to render those posts but I have declared a single state for like button using useState().
When ...
0
votes
1
answer
636
views
Flutter ListTile conditional and temporal widget rendering
I have searched around for a while now but can’t seem to find a solution to show a widget (in my case a CircularProgressIndicator) temporarily, in the trailing of a ListTile.
I have this “page”:
...
0
votes
1
answer
859
views
How to make a dynamic navbar according to the product category in React.js
I have a navbar which has three links like: Women, Men, Kids.
see the image.
picture of the used navigation
These three category are coming from a api. I have currently hardcoded the links like:
...
2
votes
1
answer
662
views
Rendering components based on multiple conditions in Reactjs
I need to improve the rendering logic so as avoid confusing multiple ternary operators. What could be the best way to do this.
I was looking for a way to use the HOC pattern for conditional render ...
0
votes
2
answers
403
views
Vue - Render new component based on page count
I'm working on an onboarding process that will collect a users name, location, job , etc.
It needs to be one question per page but as an SPA so I currently have around 20 components to conditionally ...
0
votes
3
answers
3k
views
How to add if condition inside of useState in React
I want to add if condition inside of use state.
So here is my code example:
const [buttonName, setButtonName] = useState('Connect Wallet');
const changeButtonName = () => {
localStorage....