R
Reactiflux

BIOLOGY SCIENCE – 12-55 Aug 13

BIOLOGY SCIENCE – 12-55 Aug 13

RRelativPerspektiv8/13/2022
lets say i have a HTML element to be stored as a cache. is it better to store the element in the DOM and using the display: none to hide it so the user cant see it and when needed change the display to block to make the element visible or get the content of the element like this
<div>
<span>lol</span>
content
</div>
<div>
<span>lol</span>
content
</div>
and save it to a txt file and deleting the element so it longer stays in the DOM and when needed read that saved txt file and insert the element to the DOM which method is better ? (in terms of performance and bugs / problems)
SScriptyChris8/13/2022
@BIOLOGY SCIENCE what do you want to store in that DOM? And why would you save it to file? What's your end goal?
RRelativPerspektiv8/13/2022
when a user clicks a button, a set of data is represent as html elements, the next time the button is clicked a new set of data is represented (this new data replaces the old set of data in the context of html elements) if the user wishes to look back the previous data is it better to store those html elements in a txt file and insert it to the DOM when the user requests for the previous data or keep the html elements in the DOM itself, but just hide the elements when not in use, and make then appear when the user asks for the previous data @ScriptyChris
SScriptyChris8/13/2022
Why don't you just keep that data in JS memory (object/array) and render element on user demand?
UUUnknown User8/14/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

BIOLOGY SCIENCE – 12-55 Aug 13

Join Server