loading...

re: Writing (clean) React code VIEW POST

FULL DISCUSSION
 

Creating objects and passing them as props directly in the render function is a bad practice.
For example, this

<Circle
 center={{x,y}}
 radius={radius}
/> 

will rerender <Circle> component on each render.

 

OK, it should be

// Circle renders if center or radius changes
<Circle
  center={center}
  radius={radius}
/>

Thanks for pointing out

code of conduct - report abuse