Make all of the React.Components Pure.

master
Tom Hacohen 7 years ago
parent c3e686002e
commit a6ad199023

@ -6,7 +6,7 @@ import * as colors from 'material-ui/styles/colors';
import { ContactType } from './pim-types'; import { ContactType } from './pim-types';
class AddressBook extends React.Component { class AddressBook extends React.PureComponent {
props: { props: {
entries: Array<ContactType>, entries: Array<ContactType>,
onItemClick: (contact: ContactType) => void, onItemClick: (contact: ContactType) => void,

@ -73,7 +73,7 @@ export const routeResolver = new RouteResolver({
}, },
}); });
class App extends React.Component { class App extends React.PureComponent {
state: { state: {
drawerOpen: boolean, drawerOpen: boolean,
}; };

@ -9,7 +9,7 @@ import { EventType } from './pim-types';
moment.locale('en-gb'); moment.locale('en-gb');
BigCalendar.momentLocalizer(moment); BigCalendar.momentLocalizer(moment);
class Calendar extends React.Component { class Calendar extends React.PureComponent {
state: { state: {
currentDate?: Date; currentDate?: Date;
}; };

@ -14,7 +14,7 @@ import PimItemHeader from './PimItemHeader';
import { ContactType } from './pim-types'; import { ContactType } from './pim-types';
class Contact extends React.Component { class Contact extends React.PureComponent {
props: { props: {
contact?: ContactType, contact?: ContactType,
}; };

@ -102,7 +102,7 @@ const ValueTypeComponent = (props: ValueTypeComponentProps) => {
); );
}; };
class ContactEdit extends React.Component { class ContactEdit extends React.PureComponent {
state: { state: {
uid: string, uid: string,
fn: string; fn: string;

@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
class DateTimePicker extends React.Component { class DateTimePicker extends React.PureComponent {
state: { state: {
date: string, date: string,
time: string, time: string,

@ -35,7 +35,7 @@ function formatDateRange(start: ICAL.Time, end: ICAL.Time) {
return strStart + ' - ' + strEnd; return strStart + ' - ' + strEnd;
} }
class Event extends React.Component { class Event extends React.PureComponent {
props: { props: {
event?: EventType, event?: EventType,
}; };

@ -14,7 +14,7 @@ import * as EteSync from './api/EteSync';
import { EventType } from './pim-types'; import { EventType } from './pim-types';
class EventEdit extends React.Component { class EventEdit extends React.PureComponent {
state: { state: {
uid: string, uid: string,
title: string; title: string;

@ -26,7 +26,7 @@ interface PropsType {
interface PropsTypeInner extends PropsType { interface PropsTypeInner extends PropsType {
} }
class Journal extends React.Component { class Journal extends React.PureComponent {
static defaultProps = { static defaultProps = {
prevUid: null, prevUid: null,
}; };

@ -14,7 +14,7 @@ function objValues(obj: any) {
return Object.keys(obj).map((x) => obj[x]); return Object.keys(obj).map((x) => obj[x]);
} }
class JournalAddressBook extends React.Component { class JournalAddressBook extends React.PureComponent {
props: { props: {
journal: EteSync.Journal, journal: EteSync.Journal,
entries: {[key: string]: ContactType}, entries: {[key: string]: ContactType},

@ -16,7 +16,7 @@ function objValues(obj: any) {
return Object.keys(obj).map((x) => obj[x]); return Object.keys(obj).map((x) => obj[x]);
} }
class JournalCalendar extends React.Component { class JournalCalendar extends React.PureComponent {
props: { props: {
journal: EteSync.Journal, journal: EteSync.Journal,
entries: {[key: string]: EventType}, entries: {[key: string]: EventType},

@ -14,7 +14,7 @@ import { EventType, ContactType } from './pim-types';
import * as EteSync from './api/EteSync'; import * as EteSync from './api/EteSync';
class JournalEntries extends React.Component { class JournalEntries extends React.PureComponent {
static defaultProps = { static defaultProps = {
prevUid: null, prevUid: null,
}; };

@ -15,7 +15,7 @@ interface FormErrors {
errorServer?: string; errorServer?: string;
} }
class LoginForm extends React.Component { class LoginForm extends React.PureComponent {
state: { state: {
showAdvanced?: boolean; showAdvanced?: boolean;
errors: FormErrors; errors: FormErrors;

@ -27,7 +27,7 @@ function objValues(obj: any) {
return Object.keys(obj).map((x) => obj[x]); return Object.keys(obj).map((x) => obj[x]);
} }
class Pim extends React.Component { class Pim extends React.PureComponent {
props: { props: {
etesync: CredentialsData; etesync: CredentialsData;
journals: JournalsData; journals: JournalsData;

@ -19,7 +19,7 @@ import { historyPersistor } from './persist-state-history';
const addressBookTitle = 'Address Book'; const addressBookTitle = 'Address Book';
const calendarTitle = 'Calendar'; const calendarTitle = 'Calendar';
class PimMain extends React.Component { class PimMain extends React.PureComponent {
props: { props: {
contacts: Array<ContactType>, contacts: Array<ContactType>,
events: Array<EventType>, events: Array<EventType>,

@ -10,7 +10,7 @@ import { store, StoreState, CredentialsType, fetchCredentials } from './store';
import * as C from './Constants'; import * as C from './Constants';
class Root extends React.Component { class Root extends React.PureComponent {
props: { props: {
credentials: CredentialsType; credentials: CredentialsType;
}; };

@ -30,7 +30,7 @@ interface PropsTypeInner extends PropsType {
history: any; history: any;
} }
class SideMenu extends React.Component { class SideMenu extends React.PureComponent {
props: PropsTypeInner; props: PropsTypeInner;
constructor(props: any) { constructor(props: any) {

@ -6,7 +6,7 @@ import * as EteSync from './api/EteSync';
import { JournalsData, CredentialsData } from './store'; import { JournalsData, CredentialsData } from './store';
class SideMenuJournals extends React.Component { class SideMenuJournals extends React.PureComponent {
props: { props: {
etesync: CredentialsData; etesync: CredentialsData;
journals: JournalsData; journals: JournalsData;

@ -20,7 +20,7 @@ interface PropsTypeInner extends PropsType {
entries: EntriesType; entries: EntriesType;
} }
class SyncGate extends React.Component { class SyncGate extends React.PureComponent {
props: PropsTypeInner; props: PropsTypeInner;
constructor(props: any) { constructor(props: any) {

Loading…
Cancel
Save