Some component renders are very slow
See original GitHub issueIssue Type
- Bug (https://github.com/bootstrap-styled/v4/blob/master/.github/CONTRIBUTING.md#bug-reports)
- Feature (https://github.com/bootstrap-styled/v4/blob/master/.github/CONTRIBUTING.md#feature-requests)
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
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:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 👍
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.