0
Which one is faster render to dom using quarySelector or getElementById
ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') ); Or ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.quarySelector('.root') );
4 Respuestas
0
https://beamtic.com/getelementbyid-vs-queryselector
Some other article will say query is faster. It look like not big diference in performance between this two when selecting id.
Also when you create react app default is ById, and most people dont change this at all.
0
PanicS thanks for answer my question, if quary little bit faster i will change byId to quary then
0
Some say id is faster, some say query.
Maybe is diference between task given, browser, pc setup... But diference is not big, use one you think is better. Also you can look on internet to learn how to check performance, so you can check your app and deside what to use.
0
Ok, thanks for helping me