Stiliyan
Stiliyan

Reputation: 176

React making browsers laggy

I actually have no idea where the problem is coming from, that is why I am not applying any code, I tried a lot of things, but it just doesn't seem to work. When I load my app in the browser (doesn't matter which), and when I visit 7 or more different routes, the app starts to make the browser laggy, like the loaders are not running smoothly, other animations just freeze and skip over loaders etc. And when you click to go on a new route it renders directly but there is a freeze for a short time and then the component is rendered. I am open to ideas guys, thank you in advance.

Edit: I forgot to add that I am using react-slingshot.

Upvotes: 0

Views: 54

Answers (1)

Mosè Raguzzini
Mosè Raguzzini

Reputation: 15821

Without any code snipped reproducing the issue is difficult to tell where is the problem. The most common problems that can produce this issue are:

  • Using redux and retrieving the entire tree in every container
  • Adding event listeners in a component without removing it in componentWillUnmount
  • Render big components that are re-rendered often (keypress, onScoll, onChange etc etc)

If you can post a full working snipped reproducing the problem I can provide further help.

Upvotes: 1

Related Questions