As a React developer, I run into this the too many re-renders error every so often. Not as much now as I did when I started developing React applications. My notes helped me find the solutions to this error, so these are my notes and examples:

1. Onclick:

If you are using onlclick, be sure to use an arrow function, change:

From:

onClick={setEditForm(!editForm)}

To:

onClick={()=>setEditForm(!editForm)

2. UseEffect()

UseEffect() can re-render only when a condition has been changed.

useEffect(() => {

}, [editForm])