i-like-robots / react-tags

⚛️ Legacy repo for the fantastically simple tagging component for your React projects (legacy repo)
http://i-like-robots.github.io/react-tags
MIT License
457 stars 170 forks source link

suggestion: use React memo on Input, Suggestion and Tags to avoid re render #264

Open rrfaria opened 2 years ago

rrfaria commented 2 years ago

I noticed every single time there is a blur event even if nothing is changed All componentes are rendered again

to avoid it you can use React.memo. It will memoize properties and only will render again if any property changes

you can add it to: Input, Suggestions and Tag component

import React from 'react'

class Input extends React.Component {
 // implementation ....

}
export default React.memo(Input)

you can check re render by using react dev tools image and enable highligh updates image

crazyyi commented 2 years ago

Yes it is re-rendering too often.

hritikb27 commented 2 years ago

@i-like-robots Have added it, please review my PR: https://github.com/i-like-robots/react-tags/pull/270