A handy way to completely remount a component when a variable changes is to make that variable part of the key attribute of the component.
E.g.
const someVariable = 'foobar'; <Foo key={ `foo-component-${someVariable}` } />
IT and anything that fascinates me
A handy way to completely remount a component when a variable changes is to make that variable part of the key attribute of the component.
E.g.
const someVariable = 'foobar'; <Foo key={ `foo-component-${someVariable}` } />
Thanks, you save me a lot of problems!
Glad I could be of help.
God bless you. I was literally on a verge of tears.
You’re welcome 🙂
This was SOOO much cleaner than what I was going to do..
Thanks a lot Dolapo <3