Browse Source

Merge pull request #509 from gre/perf-pillsdayscount

save about 10ms at each re-render of Account Page
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
e454c983b7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/components/PillsDaysCount.js

10
src/components/PillsDaysCount.js

@ -1,6 +1,6 @@
// @flow // @flow
import React from 'react' import React, { PureComponent } from 'react'
import { translate } from 'react-i18next' import { translate } from 'react-i18next'
import type { T } from 'types/common' import type { T } from 'types/common'
@ -9,7 +9,7 @@ import Pills from 'components/base/Pills'
type Props = { type Props = {
selectedTime: string, selectedTime: string,
onChange: Function, onChange: ({ key: string, value: *, label: string }) => void,
t: T, t: T,
} }
@ -19,8 +19,9 @@ const itemsTimes = [
{ key: 'year', value: 365 }, { key: 'year', value: 365 },
] ]
function PillsDaysCount(props: Props) { class PillsDaysCount extends PureComponent<Props> {
const { selectedTime, onChange, t } = props render() {
const { selectedTime, onChange, t } = this.props
return ( return (
<Pills <Pills
items={itemsTimes.map(item => ({ items={itemsTimes.map(item => ({
@ -32,5 +33,6 @@ function PillsDaysCount(props: Props) {
/> />
) )
} }
}
export default translate()(PillsDaysCount) export default translate()(PillsDaysCount)

Loading…
Cancel
Save