Questions tagged [conditional-rendering]

Conditionally choose which jsf tags to convert to DOM

Conditional rendering is selectively choosing which jsf( or jsp) components will be translated to the DOM elements by the javax.faces.render.Renderer in jsf framework. All jsf components have attibute rendered which evaluates to boolean. Based on this boolean Renderer chooses to create or not create the dom with this particular element.

386 questions
3
votes
2 answers

Image flickering issue in React when image is conditionally rendered

I have a header and I want to show an image on its right when the mouse is over the header. I am maintaining a variable editMode in the state which is set to true/false Then I am conditionally rendering the image using onMouseOver and onMouse…
Swapnil
  • 2,573
  • 19
  • 30
3
votes
3 answers

Conditionally render a

I am using jsf primefaces. I want to display an image depending on the value of a specific outputext. If the text value is 'Alarm *' then a div will appear whith a spesific image. If the value is 'Alarm **' then a div with an other image will…
2
votes
2 answers

How to conditionally display elements of JSP page depending on user role

How to load menu on webpage depends upon login user? I want to make websites where some menu will show before login and after login it will show more menu depends upon login user if admin is login then some administraive menu will appear if normal…
user900481
2
votes
1 answer

Input value not processed in request scoped bean when using conditional rendering

I know this type of question has been asked million times here, but I couldn't find a solution for my problem in relevant posts. JSF 1.2 I have a request-scoped bean with a method used as valueChangeListener: class DoStuff{ ... public void…
kooker
  • 363
  • 1
  • 5
  • 16
2
votes
0 answers

React - Loading images in conditional rendering - performance issue

I have a React application in which after clicking on the buttons I change the categories and each category has its own layout with text and images. The problem is that I conditionally render this layout using switch/case and every time the content…
2
votes
1 answer

I cant make a navigation bar to change its background only on main(/) content in REACT

I have a Header component like this const [small, setSmall] = useState(false) console.log(window.location.pathname) console.log(window.location.pathname === '/') useEffect(() => { if (typeof window !== "undefined")…
2
votes
1 answer

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 }) => { return ( <> {isLoggedIn &&
2
votes
1 answer

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 I click on like button in any of the posts, the…
2
votes
1 answer

Vue 3 v-if not reacting to changes within a function

What works: I want to render an element only if some boolean value is true using Vue 3. This is an example following the Vue 3 documentation and it works just fine: Template: ...
Quaenor
  • 21
  • 1
  • 3
2
votes
3 answers

Where is information stored on the client that React hides with conditional rendering?

I'm trying to determine how secure it is to hide information with conditional rendering in React. In the following React code, I hide the information "nnn" if the user is not logged in. import './App.scss'; const loggedIn = false; function App() { …
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
2
votes
0 answers

How to test a component that renders conditional display?

I try to test a functional component which use useSelector hook to get data from state and renders according to the state. I wrote a test for that component. It seems logical to me and it works. But I'm not sure if it's the correct approach. Here is…
2
votes
3 answers

Props is undefined when passed to a child component (react hooks)

I am building a simple agenda component and ran into a problem. The idea is that when a person clicks on the day and then sees trainings from this specific day. My logic is the following On button click I set state to day id On existing active item…
2
votes
2 answers

Vue js - Routing and Conditional Rendering

Hello I am relatively new to VueJS and have a question to conditional rendering while using the Cue Router. i have my routes the as the following set up: const routes = [ { path: '/', component: () => import('layouts/Layout.vue'), …
Luca
  • 57
  • 4
2
votes
1 answer

Conditional rendering between 3 page component or navigation, how to?

I want to know if conditional rendering between 3 page component is a professional way or should I do it different ? Header is the navbar but I want it disappear when signIn or signUp page components will show. With SignUp for now its like that - …
2
votes
1 answer

Conditional rendering in React based on current component state

I am struggling with figuring out how to implement conditional rendering in React. Basically, what I want to do is this: if there is a reviewResponse in the reviewResponses array, I no longer want to render the reviewResponseForm. I only want to…
user16644688
1 2
3
25 26