layout sider will render twice on first load
See original GitHub issueVersion
antd 3.1.0 react 16.2.0
Environment
chrome
Reproduction link
class MySider extends Component {
render() {
console.log('sider')
return <Sider>Sider</Sider>
}
}
class App extends Component {
render() {
return (
<Layout>
<Header>Header</Header>
<Layout>
<MySider></MySider>
<Content>Content</Content>
</Layout>
<Footer>Footer</Footer>
</Layout>
);
}
}
Steps to reproduce
When first load, Snippets above will print sider
twice
What is expected?
print sider
only once
What is actually happening?
When first load, Snippets above will print sider
twice
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Why is my react component rendering twice on initial load?
I've tried this out in code sandbox here and sure enough, it did render twice. This is because, in the index.js file, it...
Read more >React Components rendered twice — any way to fix this?
It fails to automatically detect render side effects as they often can be non-deterministic behavior. To detect side effects the following functions are...
Read more >ReactDOM – React
render () controls the contents of the container node you pass in. Any existing DOM elements inside are replaced when first called. Later...
Read more >Prevent Multiple Renders in React - YouTube
When component loads first time, it renders twice because it is logging in console ... Strict Mode does not render any visibble UI...
Read more >Are my components supposed to render multiple times? - Reddit
You still will be rendering a loading state followed by the actual data in most cases. If you're using server-side rendering, you can...
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
I can’t really understand this. If this action will cause rerender, why can’t implement Sider in other way, which cause no rerender.
For me as an user, rerender is the last thing I want.