mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
refactor(features/ui): Avoid useless renders in WrappedSwitch (#5580)
This commit is contained in:
parent
763a2f8511
commit
5521e94e24
@ -7,11 +7,19 @@ import BundleColumnError from '../components/bundle_column_error';
|
||||
import BundleContainer from '../containers/bundle_container';
|
||||
|
||||
// Small wrapper to pass multiColumn to the route components
|
||||
export const WrappedSwitch = ({ multiColumn, children }) => (
|
||||
<Switch>
|
||||
{React.Children.map(children, child => React.cloneElement(child, { multiColumn }))}
|
||||
</Switch>
|
||||
);
|
||||
export class WrappedSwitch extends React.PureComponent {
|
||||
|
||||
render () {
|
||||
const { multiColumn, children } = this.props;
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
{React.Children.map(children, child => React.cloneElement(child, { multiColumn }))}
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WrappedSwitch.propTypes = {
|
||||
multiColumn: PropTypes.bool,
|
||||
|
Loading…
Reference in New Issue
Block a user