You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've just started my React journey few days ago,
I got a question (I migth sound stupid), It's in my head from past 2-3 days.
The Question:
Suppose we have a table with list of Super-heros, and each row contains a Edit button, clicking that opens a modal with a Edit form.
Now my concern is,
Should I put the Modal inside of the Super-heros loop, or create the Modal along with a State outside of the loop.
And we'll update the state from within the loop to open/close the outside modal.
Which would be considered as good practice and also good for performance.
My Thought:
I think how Headless UI's modals work like: whenever the modal get's opened then only it get's rendered to the DOM.
So having the Modal components inside of loop shouldn't matter.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've just started my React journey few days ago,
I got a question (I migth sound stupid), It's in my head from past 2-3 days.
The Question:
Suppose we have a table with list of Super-heros, and each row contains a Edit button, clicking that opens a modal with a Edit form.
Now my concern is,
Should I put the Modal inside of the Super-heros loop, or create the Modal along with a State outside of the loop.
And we'll update the state from within the loop to open/close the outside modal.
Which would be considered as good practice and also good for performance.
My Thought:
I think how Headless UI's modals work like: whenever the modal get's opened then only it get's rendered to the DOM.
So having the Modal components inside of loop shouldn't matter.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions