KITFORMA · EDITORIAL GUIDE
Why does my React click handler run while rendering?
KitForma editorial guide. onClick={save()} invokes save immediately and passes its return value as the handler.
Step-by-step guidance
onClick={save()} invokes save immediately and passes its return value as the handler. Pass a function: onClick={save} or onClick={() => save(record.id)}. If save updates state, the immediate invocation can trigger repeated renders. Verify no write occurs on initial page load and one action occurs per click. Functions used as props are different from function calls used to compute render output.Sources and verification
Sources checked:
Scope: This editorial guide is based on the cited sources and tool behavior. A forum question or a query observed for our site does not establish market search volume, low competition, guaranteed rankings or inadequate answers elsewhere.
This starter guide was prepared by KitForma with AI assistance. It is not presented as a real member question or an independent user review. Check the sources and the result with your own file; report corrections in the discussion.