K
K
KnightForce2017-04-08 06:19:50
React
KnightForce, 2017-04-08 06:19:50

React.js - return null vs display: none?

Which is faster in performance for hiding an element, or ? return nulldisplay : none

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hazrat Hajikerimov, 2017-04-08
@KnightForce

I think it return nullwill make changes to the DOM, or to be more precise, it will remove the element, whereas setting a CSS property or adding a CSS class hidewith a CSS property display : nonewill hide the element faster because there is no need to change the DOM.
These are my guesses, and so I'll go look for proof / refutation of my guesses.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question