question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some component renders are very slow

See original GitHub issue

Issue Type

Description

V4 styled components are causing the render time of my app to grow massivly. Running a profiler I see that Label and Button are the main culprits

Steps to reproduce

I don’t have a demo

  • Create app
  • Add a few rows/ columns with Button and labels in
  • Load app while profiler is running

Note that the labels and buttons are rendering in the order of 2-3 seconds each!

Most other components are in the order of 10-20ms

Screenshot 2020-06-30 at 07 23 42 Screenshot 2020-06-30 at 07 24 12
return (
    <Row>
      <Col>
        <Form className="bg-light p-2">
          <Row>
            <FormColumnGroup>
              <Label htmlFor="startDistance">Target date</Label>
            </FormColumnGroup>
...
        <Button
            color="primary"
            className="text-light text-uppercase font-weight-bold"
            type="submit"
            disabled={!valid || error || submitting}
            onClick={(e) => {
              e.preventDefault();
              handleSubmit(userCriteria);
            }}
          >
            Create plan
          </Button>
        </Form>
      </Col>
    </Row>

Is this a known issue or am I doing something wrong?

Versions

  • Node/NPM: 12.16.3
  • OS: OS X 10.15.4
  • v4: 3.4.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Designer023commented, Jun 30, 2020

@kopax Sure thing. Thank you for the quick reply. I will create a quick demo with the same setup to show you.

I would be happy to help migrate components to hooks if I can do so myself and contribute 👍

0reactions
kopaxcommented, Jul 10, 2020

Hi @Designer023 I understand no worries, this should be done after all of our current obligation of course.

Regarding your linting error, I have not seen any. Can you please post a reproduction so I can have the same error I might help you on that one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Detect Slow Renders in React? - Alex Sidorenko
Open React Developer Tools Profiler tab. Click the record button to start profiling. Interact with the part of your app that feels slow,...
Read more >
Fix the slow render before you fix the re-render - Kent C. Dodds
Unnecessary re-renders​​ Every time you click on the button, the Foo function is called, but the DOM that it represents is not re-rendered. ......
Read more >
React is slow when rendering many elements - Stack Overflow
The reason it is slow is because each cell, at a slightly different time, triggers a new render on their own since each...
Read more >
Techniques to optimize react render performance: part 1 - Anvil
You can see the slow render is made up of a ton of other component renders. Each of these renders takes up only...
Read more >
How to improve slow React application rendering
Hooks can play a major role in reducing the number of re-renders. Remember re-render happens whenever there is a change in a state...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found