User avatar
pathetic piss kitten @kitten@elizabeth.cat
10mo
work, webdev so

I have a (legacy) React application in which a page returns a completely different tree depending on if it's mobile or desktop (using the page width to determine that)

we need to add a component in there which holds some internal state, which can be changed by user interaction. the issue we're facing is that, if the user resizes the page, causing it to switch between the desktop and the mobile tree, the component re-mounts, and thus it resets to its initial state

anyone has any idea on how to avoid that?
2
2
0
0

User avatar
Savannah (gamedev arc) @sav_imagines@tech.lgbt
10mo
work, webdev @kitten uhh keep that state outside the rendering component with a container-presentation architecture?
0
0
0
0
User avatar
Klaus Frank @agowa338@chaos.social
10mo
work, webdev @kitten cookies
1
0
1
0
User avatar
pathetic piss kitten @kitten@elizabeth.cat
10mo
work, webdev @agowa338 ​:neocat_laptop_notice:​
0
0
1
0