From 4550355e8d44c66a5782fedbfd9b581a220430c2 Mon Sep 17 00:00:00 2001 From: Zaim Date: Tue, 2 Apr 2019 11:31:37 +0800 Subject: [PATCH 1/2] perf(components): memo implementation all stateless components moved to functionalcomponents with memo implementation for better performance --- develop/components/common/NotFound.tsx | 2 +- develop/components/common/SideBar.tsx | 2 +- src/Breadcrumb/Breadcrumb.tsx | 4 ++-- src/Button/Button.tsx | 4 ++-- src/Carousel/Carousel.tsx | 4 ++-- src/CheckBox/CheckBox.tsx | 4 ++-- src/Datepicker/Datepicker.tsx | 4 ++-- src/DropDown/DropDown.tsx | 4 ++-- src/Icon/Icon.tsx | 4 ++-- src/Image/Image.tsx | 4 ++-- src/ImageCropper/Loader.tsx | 2 +- src/InlineLink/InlineLink.tsx | 4 ++-- src/Loader/Loader.tsx | 4 ++-- src/Pagination/Pagination.tsx | 4 ++-- src/ProgressBar/ProgressBar.tsx | 4 ++-- src/RadioButton/RadioButton.tsx | 4 ++-- src/RadioGroup/RadioGroup.tsx | 4 ++-- src/Rating/Rating.tsx | 4 ++-- src/Rating/RatingStar.tsx | 4 ++-- src/Slider/Slider.tsx | 4 ++-- src/StepTracker/StepTracker.tsx | 4 ++-- src/Stepper/Stepper.tsx | 4 ++-- src/Tabs/Tabs.tsx | 4 ++-- src/TextArea/TextArea.tsx | 4 ++-- src/TextBox/TextBox.tsx | 4 ++-- src/TextBoxGroup/TextBoxGroup.tsx | 4 ++-- src/TextLabel/TextLabel.tsx | 4 ++-- src/Timeline/Timeline.tsx | 4 ++-- src/Toggle/Toggle.tsx | 4 ++-- src/Tooltip/readme.md | 2 +- src/Video/Video.tsx | 4 ++-- 31 files changed, 58 insertions(+), 58 deletions(-) diff --git a/develop/components/common/NotFound.tsx b/develop/components/common/NotFound.tsx index 5a7e8f98c..406d71426 100644 --- a/develop/components/common/NotFound.tsx +++ b/develop/components/common/NotFound.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { NavLink } from "react-router-dom"; -const NotFound: React.StatelessComponent = (): React.ReactElement => { +const NotFound: React.FunctionComponent = (): React.ReactElement => { return (
diff --git a/develop/components/common/SideBar.tsx b/develop/components/common/SideBar.tsx index 7a71076ac..5e716e427 100644 --- a/develop/components/common/SideBar.tsx +++ b/develop/components/common/SideBar.tsx @@ -10,7 +10,7 @@ interface SideBarProps { toggle: boolean; } -const SideBar: React.StatelessComponent = (props: SideBarProps): React.ReactElement => { +const SideBar: React.FunctionComponent = (props: SideBarProps): React.ReactElement => { const str = location.href.toLowerCase(); const page = str.substr(str.lastIndexOf("/")); diff --git a/src/Breadcrumb/Breadcrumb.tsx b/src/Breadcrumb/Breadcrumb.tsx index 95034eb41..a543a9548 100644 --- a/src/Breadcrumb/Breadcrumb.tsx +++ b/src/Breadcrumb/Breadcrumb.tsx @@ -7,7 +7,7 @@ interface BreadcrumbProps { className?: string; } -export const Breadcrumb: React.StatelessComponent = (props: BreadcrumbProps): React.ReactElement => { +export const Breadcrumb: React.FunctionComponent = React.memo((props: BreadcrumbProps): React.ReactElement => { return (
); -}; +}); diff --git a/src/Button/Button.tsx b/src/Button/Button.tsx index eb753fa0f..63f757145 100644 --- a/src/Button/Button.tsx +++ b/src/Button/Button.tsx @@ -12,7 +12,7 @@ export interface ButtonProps { iconPosition?: string; } -export const Button: React.StatelessComponent = (props: ButtonProps): React.ReactElement => { +export const Button: React.FunctionComponent = React.memo((props: ButtonProps): React.ReactElement => { return (
); -}; +}); diff --git a/src/Carousel/Carousel.tsx b/src/Carousel/Carousel.tsx index 778423326..96f9a76ec 100644 --- a/src/Carousel/Carousel.tsx +++ b/src/Carousel/Carousel.tsx @@ -20,7 +20,7 @@ interface CarouselProps { className?: string; } -export const Carousel: React.StatelessComponent = (props: CarouselProps): React.ReactElement => { +export const Carousel: React.FunctionComponent = React.memo((props: CarouselProps): React.ReactElement => { const settings: Settings = { direction: "horizontal", observer: true, @@ -67,4 +67,4 @@ export const Carousel: React.StatelessComponent = (props: Carouse } ); -}; +}); diff --git a/src/CheckBox/CheckBox.tsx b/src/CheckBox/CheckBox.tsx index 567bd57da..2fff3faf5 100644 --- a/src/CheckBox/CheckBox.tsx +++ b/src/CheckBox/CheckBox.tsx @@ -15,7 +15,7 @@ export interface CheckBoxProps { reference?: React.RefObject; } -export const CheckBox: React.StatelessComponent = (props: CheckBoxProps): React.ReactElement => { +export const CheckBox: React.FunctionComponent = React.memo((props: CheckBoxProps): React.ReactElement => { return (
@@ -39,4 +39,4 @@ export const CheckBox: React.StatelessComponent = (props: CheckBo
); -}; +}); diff --git a/src/Datepicker/Datepicker.tsx b/src/Datepicker/Datepicker.tsx index 7a9467fb3..9fd1b1264 100644 --- a/src/Datepicker/Datepicker.tsx +++ b/src/Datepicker/Datepicker.tsx @@ -18,7 +18,7 @@ export interface DatepickerProps { locale?: string; } -export const Datepicker: React.StatelessComponent = (props: DatepickerProps): React.ReactElement => { +export const Datepicker: React.FunctionComponent = React.memo((props: DatepickerProps): React.ReactElement => { return (
@@ -40,4 +40,4 @@ export const Datepicker: React.StatelessComponent = (props: Dat
); -}; +}); diff --git a/src/DropDown/DropDown.tsx b/src/DropDown/DropDown.tsx index b1678d70a..45dfe1900 100644 --- a/src/DropDown/DropDown.tsx +++ b/src/DropDown/DropDown.tsx @@ -23,7 +23,7 @@ export interface DropDownProps { disabled?: boolean; } -export const DropDown: React.StatelessComponent = (props: DropDownProps): React.ReactElement => { +export const DropDown: React.FunctionComponent = React.memo((props: DropDownProps): React.ReactElement => { return (
= (props: DropDow
); -}; +}); diff --git a/src/Icon/Icon.tsx b/src/Icon/Icon.tsx index 5f0747185..7d2195786 100644 --- a/src/Icon/Icon.tsx +++ b/src/Icon/Icon.tsx @@ -9,7 +9,7 @@ export interface IconProps { onClick?: (event: any) => void; } -export const Icon: React.StatelessComponent = (props: IconProps): React.ReactElement => { +export const Icon: React.FunctionComponent = React.memo((props: IconProps): React.ReactElement => { return (
= (props: IconProps): Rea {props.src}
); -}; +}); diff --git a/src/Image/Image.tsx b/src/Image/Image.tsx index 64317a080..6d5f572a6 100644 --- a/src/Image/Image.tsx +++ b/src/Image/Image.tsx @@ -11,7 +11,7 @@ export interface ImageProps { useImgTag?: boolean; } -export const Image: React.StatelessComponent = (props: ImageProps): React.ReactElement => { +export const Image: React.FunctionComponent = React.memo((props: ImageProps): React.ReactElement => { return ( <> {!props.useImgTag && @@ -39,4 +39,4 @@ export const Image: React.StatelessComponent = (props: ImageProps): } ); -}; +}); diff --git a/src/ImageCropper/Loader.tsx b/src/ImageCropper/Loader.tsx index 47f15ba65..32b8e193e 100644 --- a/src/ImageCropper/Loader.tsx +++ b/src/ImageCropper/Loader.tsx @@ -7,7 +7,7 @@ export interface LoaderProps { className?: string; } -export const Loader: React.StatelessComponent = (props: LoaderProps): React.ReactElement => { +export const Loader: React.FunctionComponent = (props: LoaderProps): React.ReactElement => { const fullscreen: boolean = props.fullscreen === undefined ? true : props.fullscreen; let loaderWrapper: string = "loader-cropper "; if (fullscreen) { loaderWrapper += "fullscreen "; } diff --git a/src/InlineLink/InlineLink.tsx b/src/InlineLink/InlineLink.tsx index 03c237c2d..bc12f5250 100644 --- a/src/InlineLink/InlineLink.tsx +++ b/src/InlineLink/InlineLink.tsx @@ -7,7 +7,7 @@ interface InlineLinkProps { children?: any; } -export const InlineLink: React.StatelessComponent = (props: InlineLinkProps): React.ReactElement => { +export const InlineLink: React.FunctionComponent = React.memo((props: InlineLinkProps): React.ReactElement => { return ( = (props: Inl {props.children} ); -}; +}); diff --git a/src/Loader/Loader.tsx b/src/Loader/Loader.tsx index 46a9200e0..de683a7c9 100644 --- a/src/Loader/Loader.tsx +++ b/src/Loader/Loader.tsx @@ -7,7 +7,7 @@ export interface LoaderProps { className?: string; } -export const Loader: React.StatelessComponent = (props: LoaderProps): React.ReactElement => { +export const Loader: React.FunctionComponent = React.memo((props: LoaderProps): React.ReactElement => { const fullscreen: boolean = props.fullscreen === undefined ? true : props.fullscreen; let loaderWrapper: string = "loaderWrapper "; if (fullscreen) { loaderWrapper += "fullscreen "; } @@ -21,4 +21,4 @@ export const Loader: React.StatelessComponent = (props: LoaderProps } ); -}; +}); diff --git a/src/Pagination/Pagination.tsx b/src/Pagination/Pagination.tsx index dfd54fdbd..fb5ee3c39 100644 --- a/src/Pagination/Pagination.tsx +++ b/src/Pagination/Pagination.tsx @@ -21,7 +21,7 @@ export interface PaginationProps { onChange?: (value: number) => void; } -export const Pagination: React.StatelessComponent = (props: PaginationProps): React.ReactElement => { +export const Pagination: React.FunctionComponent = React.memo((props: PaginationProps): React.ReactElement => { const Initialoffset: number = props.offset ? props.offset : 10; /** @@ -142,4 +142,4 @@ export const Pagination: React.StatelessComponent = (props: Pag ); -}; +}); diff --git a/src/ProgressBar/ProgressBar.tsx b/src/ProgressBar/ProgressBar.tsx index eab9bbeb4..144594d7f 100644 --- a/src/ProgressBar/ProgressBar.tsx +++ b/src/ProgressBar/ProgressBar.tsx @@ -7,7 +7,7 @@ export interface ProgressBarProps { className?: string; } -export const ProgressBar: React.StatelessComponent = (props: ProgressBarProps): React.ReactElement => { +export const ProgressBar: React.FunctionComponent = React.memo((props: ProgressBarProps): React.ReactElement => { return (
@@ -16,4 +16,4 @@ export const ProgressBar: React.StatelessComponent = (props: P }
); -}; +}); diff --git a/src/RadioButton/RadioButton.tsx b/src/RadioButton/RadioButton.tsx index d0e2ea641..439c0c6cb 100644 --- a/src/RadioButton/RadioButton.tsx +++ b/src/RadioButton/RadioButton.tsx @@ -16,7 +16,7 @@ export interface RadioButtonProps { reference?: React.RefObject; } -export const RadioButton: React.StatelessComponent = (props: RadioButtonProps): React.ReactElement => { +export const RadioButton: React.FunctionComponent = React.memo((props: RadioButtonProps): React.ReactElement => { let inputFieldClass: string = "input-field"; if (props.error) { inputFieldClass += " has-error"; } if (props.inline) { inputFieldClass += " inline"; } @@ -46,4 +46,4 @@ export const RadioButton: React.StatelessComponent = (props: R
); -}; +}); diff --git a/src/RadioGroup/RadioGroup.tsx b/src/RadioGroup/RadioGroup.tsx index a911ecbaf..e31ab9430 100644 --- a/src/RadioGroup/RadioGroup.tsx +++ b/src/RadioGroup/RadioGroup.tsx @@ -21,7 +21,7 @@ export interface RadioGroupProps { disableAll?: boolean; } -export const RadioGroup: React.StatelessComponent = (props: RadioGroupProps): React.ReactElement => { +export const RadioGroup: React.FunctionComponent = React.memo((props: RadioGroupProps): React.ReactElement => { let inputFieldClass: string = "input-field"; if (props.error) { inputFieldClass += " has-error"; } if (props.inline) { inputFieldClass += " inline"; } @@ -54,4 +54,4 @@ export const RadioGroup: React.StatelessComponent = (props: Rad ); -}; +}); diff --git a/src/Rating/Rating.tsx b/src/Rating/Rating.tsx index d1fc720c1..10b758b39 100644 --- a/src/Rating/Rating.tsx +++ b/src/Rating/Rating.tsx @@ -20,7 +20,7 @@ interface RatingProps { */ const initialColors: Array = ["#A9A9A9", "#FFC500"]; -export const Rating: React.StatelessComponent = (props: RatingProps): React.ReactElement => { +export const Rating: React.FunctionComponent = React.memo((props: RatingProps): React.ReactElement => { const height: number = props.iconHeight || 25; const width: number = props.iconWidth || 25; @@ -58,4 +58,4 @@ export const Rating: React.StatelessComponent = (props: RatingProps /> ); -}; +}); diff --git a/src/Rating/RatingStar.tsx b/src/Rating/RatingStar.tsx index 878db5890..431bb84c9 100644 --- a/src/Rating/RatingStar.tsx +++ b/src/Rating/RatingStar.tsx @@ -7,7 +7,7 @@ interface StarProps { title?: any; } -export const SVGStarHollow: React.StatelessComponent = (props: StarProps): React.ReactElement => { +export const SVGStarHollow: React.FunctionComponent = (props: StarProps): React.ReactElement => { return ( = (props: StarPr ); }; -export const SVGStar: React.StatelessComponent = (props: StarProps): React.ReactElement => { +export const SVGStar: React.FunctionComponent = (props: StarProps): React.ReactElement => { return ( ; } -export const Slider: React.StatelessComponent = (props: SliderProps): React.ReactElement => { +export const Slider: React.FunctionComponent = React.memo((props: SliderProps): React.ReactElement => { const min: number = props.min ? props.min : 0; const max: number = props.max ? props.max : 100; @@ -107,4 +107,4 @@ export const Slider: React.StatelessComponent = (props: SliderProps ); -}; +}); diff --git a/src/StepTracker/StepTracker.tsx b/src/StepTracker/StepTracker.tsx index 9b933043d..d8f8825f9 100644 --- a/src/StepTracker/StepTracker.tsx +++ b/src/StepTracker/StepTracker.tsx @@ -13,7 +13,7 @@ export interface StepTrackerProps { orientation?: string; } -export const StepTracker: React.StatelessComponent = (props: StepTrackerProps): React.ReactElement => { +export const StepTracker: React.FunctionComponent = React.memo((props: StepTrackerProps): React.ReactElement => { let topLabel: boolean; let bottomLabel: boolean; let rightLabel: boolean; @@ -171,4 +171,4 @@ export const StepTracker: React.StatelessComponent = (props: S ); -}; +}); diff --git a/src/Stepper/Stepper.tsx b/src/Stepper/Stepper.tsx index 35671ff68..a94da8f54 100644 --- a/src/Stepper/Stepper.tsx +++ b/src/Stepper/Stepper.tsx @@ -16,7 +16,7 @@ export interface StepperProps { reference?: React.RefObject; } -export const Stepper: React.StatelessComponent = (props: StepperProps): React.ReactElement => { +export const Stepper: React.FunctionComponent = React.memo((props: StepperProps): React.ReactElement => { return (
{props.label && } @@ -40,4 +40,4 @@ export const Stepper: React.StatelessComponent = (props: StepperPr {props.error &&
{props.error}
}
); -}; +}); diff --git a/src/Tabs/Tabs.tsx b/src/Tabs/Tabs.tsx index b28ec313c..5ef25f482 100644 --- a/src/Tabs/Tabs.tsx +++ b/src/Tabs/Tabs.tsx @@ -13,7 +13,7 @@ interface TabsProps { className?: string; } -export const Tabs: React.StatelessComponent = (props: TabsProps): React.ReactElement => { +export const Tabs: React.FunctionComponent = React.memo((props: TabsProps): React.ReactElement => { return (
    @@ -33,4 +33,4 @@ export const Tabs: React.StatelessComponent = (props: TabsProps): Rea
); -}; +}); diff --git a/src/TextArea/TextArea.tsx b/src/TextArea/TextArea.tsx index 5cbc018d7..03ce79fff 100644 --- a/src/TextArea/TextArea.tsx +++ b/src/TextArea/TextArea.tsx @@ -24,7 +24,7 @@ export interface TextAreaProps { reference?: React.RefObject; } -export const TextArea: React.StatelessComponent = (props: TextAreaProps): React.ReactElement => { +export const TextArea: React.FunctionComponent = React.memo((props: TextAreaProps): React.ReactElement => { return (
@@ -52,4 +52,4 @@ export const TextArea: React.StatelessComponent = (props: TextAre
); -}; +}); diff --git a/src/TextBox/TextBox.tsx b/src/TextBox/TextBox.tsx index 2503d1cb3..74d345a68 100644 --- a/src/TextBox/TextBox.tsx +++ b/src/TextBox/TextBox.tsx @@ -23,7 +23,7 @@ export interface TextBoxProps { reference?: React.RefObject; } -export const TextBox: React.StatelessComponent = (props: TextBoxProps): React.ReactElement => { +export const TextBox: React.FunctionComponent = React.memo((props: TextBoxProps): React.ReactElement => { return (
@@ -51,4 +51,4 @@ export const TextBox: React.StatelessComponent = (props: TextBoxPr
); -}; +}); diff --git a/src/TextBoxGroup/TextBoxGroup.tsx b/src/TextBoxGroup/TextBoxGroup.tsx index 4de33f248..f52f650bf 100644 --- a/src/TextBoxGroup/TextBoxGroup.tsx +++ b/src/TextBoxGroup/TextBoxGroup.tsx @@ -34,7 +34,7 @@ export interface TextBoxGroupProps { reference?: React.RefObject; } -export const TextBoxGroup: React.StatelessComponent = (props: TextBoxGroupProps) => { +export const TextBoxGroup: React.FunctionComponent = React.memo((props: TextBoxGroupProps) => { return (
{props.label && } @@ -84,4 +84,4 @@ export const TextBoxGroup: React.StatelessComponent = (props:
); -}; +}); diff --git a/src/TextLabel/TextLabel.tsx b/src/TextLabel/TextLabel.tsx index 76c6a4505..75f327833 100644 --- a/src/TextLabel/TextLabel.tsx +++ b/src/TextLabel/TextLabel.tsx @@ -8,11 +8,11 @@ export interface TextLabelProps { className?: string; } -export const TextLabel: React.StatelessComponent = (props: TextLabelProps): React.ReactElement => { +export const TextLabel: React.FunctionComponent = React.memo((props: TextLabelProps): React.ReactElement => { return (
{props.label && }
{props.value}
); -}; +}); diff --git a/src/Timeline/Timeline.tsx b/src/Timeline/Timeline.tsx index da46d6855..4f58acc3c 100644 --- a/src/Timeline/Timeline.tsx +++ b/src/Timeline/Timeline.tsx @@ -29,7 +29,7 @@ function prepareList(list: Array): Array { return [topList, bottomList]; } -export const Timeline: React.StatelessComponent = (props: TimelineProps): React.ReactElement => { +export const Timeline: React.FunctionComponent = React.memo((props: TimelineProps): React.ReactElement => { const direction: string = props.direction ? props.direction : "vertical"; const preparedLists = prepareList(props.list); const topList: Array = preparedLists[0]; @@ -87,4 +87,4 @@ export const Timeline: React.StatelessComponent = (props: Timelin ); -}; +}); diff --git a/src/Toggle/Toggle.tsx b/src/Toggle/Toggle.tsx index 4f1d7b2d5..ed7bcaa06 100644 --- a/src/Toggle/Toggle.tsx +++ b/src/Toggle/Toggle.tsx @@ -10,7 +10,7 @@ export interface ToggleProps { reference?: React.RefObject; } -export const Toggle: React.StatelessComponent = (props: ToggleProps): React.ReactElement => { +export const Toggle: React.FunctionComponent = React.memo((props: ToggleProps): React.ReactElement => { return (
@@ -28,4 +28,4 @@ export const Toggle: React.StatelessComponent = (props: ToggleProps {props.label &&
{props.label}
}
); -}; +}); diff --git a/src/Tooltip/readme.md b/src/Tooltip/readme.md index 180ccddab..287853088 100644 --- a/src/Tooltip/readme.md +++ b/src/Tooltip/readme.md @@ -51,7 +51,7 @@ These are the public methods accessible via [React ref](https://reactjs.org/docs ##### Example usage of forceDismiss and ref. This example shows how to allow the tooltip to be dismissed when clicked outside ```javascript -const ExampleContainer: React.StatelessComponent = () => { +const ExampleContainer: React.FunctionComponent = () => { MyTooltip: Tooltip; return ( diff --git a/src/Video/Video.tsx b/src/Video/Video.tsx index 2bbb5be63..78f8c24a2 100644 --- a/src/Video/Video.tsx +++ b/src/Video/Video.tsx @@ -15,7 +15,7 @@ export interface VideoProps { allowFullScreen?: boolean; } -export const Video: React.StatelessComponent = (props: VideoProps): React.ReactElement => { +export const Video: React.FunctionComponent = React.memo((props: VideoProps): React.ReactElement => { return (
{props.sourceType === "local" && @@ -49,4 +49,4 @@ export const Video: React.StatelessComponent = (props: VideoProps): }
); -}; +}); From c3ee4e740ee8a95a0a7f13c62f8466bed06c5ab8 Mon Sep 17 00:00:00 2001 From: Zaim Date: Wed, 3 Apr 2019 15:06:06 +0800 Subject: [PATCH 2/2] refactor(components): removed memo from few input based components --- src/Carousel/Carousel.tsx | 4 ++-- src/Chart/Chart.tsx | 40 +++++++++++++------------------ src/CheckBox/CheckBox.tsx | 4 ++-- src/Datepicker/Datepicker.tsx | 4 ++-- src/DropDown/DropDown.tsx | 4 ++-- src/ProgressBar/ProgressBar.tsx | 4 ++-- src/RadioButton/RadioButton.tsx | 4 ++-- src/RadioGroup/RadioGroup.tsx | 4 ++-- src/Rating/Rating.tsx | 4 ++-- src/Slider/Slider.tsx | 4 ++-- src/Stepper/Stepper.tsx | 4 ++-- src/TextArea/TextArea.tsx | 4 ++-- src/TextBox/TextBox.tsx | 4 ++-- src/TextBoxGroup/TextBoxGroup.tsx | 4 ++-- src/Toggle/Toggle.tsx | 4 ++-- src/Video/Video.tsx | 4 ++-- 16 files changed, 47 insertions(+), 53 deletions(-) diff --git a/src/Carousel/Carousel.tsx b/src/Carousel/Carousel.tsx index 96f9a76ec..14e976cd7 100644 --- a/src/Carousel/Carousel.tsx +++ b/src/Carousel/Carousel.tsx @@ -20,7 +20,7 @@ interface CarouselProps { className?: string; } -export const Carousel: React.FunctionComponent = React.memo((props: CarouselProps): React.ReactElement => { +export const Carousel: React.FunctionComponent = (props: CarouselProps): React.ReactElement => { const settings: Settings = { direction: "horizontal", observer: true, @@ -67,4 +67,4 @@ export const Carousel: React.FunctionComponent = React.memo((prop } ); -}); +}; diff --git a/src/Chart/Chart.tsx b/src/Chart/Chart.tsx index c54eb1ec8..634f08968 100644 --- a/src/Chart/Chart.tsx +++ b/src/Chart/Chart.tsx @@ -12,41 +12,35 @@ export interface ChartProps { onClick?: (event: any) => void; } -export class Chart extends React.Component { - constructor(props) { - super(props); - } - - renderChart(type: string) { +export const Chart: React.FunctionComponent = (props: ChartProps): React.ReactElement => { + function renderChart(type: string) { switch (type) { case "line": - return ; + return ; case "bar": - return ; + return ; case "horizontalBar": - return ; + return ; case "pie": - return ; + return ; case "doughnut": - return ; + return ; case "polar": - return ; + return ; case "radar": - return ; + return ; case "bubble": - return ; + return ; case "scatter": - return ; + return ; default: return
Unknown chart type
; } } - render() { - return ( -
- {this.renderChart(this.props.chartType)} -
- ); - } -} + return ( +
+ {renderChart(props.chartType)} +
+ ); +}; diff --git a/src/CheckBox/CheckBox.tsx b/src/CheckBox/CheckBox.tsx index 2fff3faf5..29c57fe86 100644 --- a/src/CheckBox/CheckBox.tsx +++ b/src/CheckBox/CheckBox.tsx @@ -15,7 +15,7 @@ export interface CheckBoxProps { reference?: React.RefObject; } -export const CheckBox: React.FunctionComponent = React.memo((props: CheckBoxProps): React.ReactElement => { +export const CheckBox: React.FunctionComponent = (props: CheckBoxProps): React.ReactElement => { return (
@@ -39,4 +39,4 @@ export const CheckBox: React.FunctionComponent = React.memo((prop
); -}); +}; diff --git a/src/Datepicker/Datepicker.tsx b/src/Datepicker/Datepicker.tsx index 9fd1b1264..b1b92ad74 100644 --- a/src/Datepicker/Datepicker.tsx +++ b/src/Datepicker/Datepicker.tsx @@ -18,7 +18,7 @@ export interface DatepickerProps { locale?: string; } -export const Datepicker: React.FunctionComponent = React.memo((props: DatepickerProps): React.ReactElement => { +export const Datepicker: React.FunctionComponent = (props: DatepickerProps): React.ReactElement => { return (
@@ -40,4 +40,4 @@ export const Datepicker: React.FunctionComponent = React.memo((
); -}); +}; diff --git a/src/DropDown/DropDown.tsx b/src/DropDown/DropDown.tsx index 45dfe1900..81a78d371 100644 --- a/src/DropDown/DropDown.tsx +++ b/src/DropDown/DropDown.tsx @@ -23,7 +23,7 @@ export interface DropDownProps { disabled?: boolean; } -export const DropDown: React.FunctionComponent = React.memo((props: DropDownProps): React.ReactElement => { +export const DropDown: React.FunctionComponent = (props: DropDownProps): React.ReactElement => { return (
= React.memo((prop
); -}); +}; diff --git a/src/ProgressBar/ProgressBar.tsx b/src/ProgressBar/ProgressBar.tsx index 144594d7f..0256e776e 100644 --- a/src/ProgressBar/ProgressBar.tsx +++ b/src/ProgressBar/ProgressBar.tsx @@ -7,7 +7,7 @@ export interface ProgressBarProps { className?: string; } -export const ProgressBar: React.FunctionComponent = React.memo((props: ProgressBarProps): React.ReactElement => { +export const ProgressBar: React.FunctionComponent = (props: ProgressBarProps): React.ReactElement => { return (
@@ -16,4 +16,4 @@ export const ProgressBar: React.FunctionComponent = React.memo }
); -}); +}; diff --git a/src/RadioButton/RadioButton.tsx b/src/RadioButton/RadioButton.tsx index 439c0c6cb..55e1d40dc 100644 --- a/src/RadioButton/RadioButton.tsx +++ b/src/RadioButton/RadioButton.tsx @@ -16,7 +16,7 @@ export interface RadioButtonProps { reference?: React.RefObject; } -export const RadioButton: React.FunctionComponent = React.memo((props: RadioButtonProps): React.ReactElement => { +export const RadioButton: React.FunctionComponent = (props: RadioButtonProps): React.ReactElement => { let inputFieldClass: string = "input-field"; if (props.error) { inputFieldClass += " has-error"; } if (props.inline) { inputFieldClass += " inline"; } @@ -46,4 +46,4 @@ export const RadioButton: React.FunctionComponent = React.memo
); -}); +}; diff --git a/src/RadioGroup/RadioGroup.tsx b/src/RadioGroup/RadioGroup.tsx index e31ab9430..0f98cc0eb 100644 --- a/src/RadioGroup/RadioGroup.tsx +++ b/src/RadioGroup/RadioGroup.tsx @@ -21,7 +21,7 @@ export interface RadioGroupProps { disableAll?: boolean; } -export const RadioGroup: React.FunctionComponent = React.memo((props: RadioGroupProps): React.ReactElement => { +export const RadioGroup: React.FunctionComponent = (props: RadioGroupProps): React.ReactElement => { let inputFieldClass: string = "input-field"; if (props.error) { inputFieldClass += " has-error"; } if (props.inline) { inputFieldClass += " inline"; } @@ -54,4 +54,4 @@ export const RadioGroup: React.FunctionComponent = React.memo(( ); -}); +}; diff --git a/src/Rating/Rating.tsx b/src/Rating/Rating.tsx index 10b758b39..d973293bb 100644 --- a/src/Rating/Rating.tsx +++ b/src/Rating/Rating.tsx @@ -20,7 +20,7 @@ interface RatingProps { */ const initialColors: Array = ["#A9A9A9", "#FFC500"]; -export const Rating: React.FunctionComponent = React.memo((props: RatingProps): React.ReactElement => { +export const Rating: React.FunctionComponent = (props: RatingProps): React.ReactElement => { const height: number = props.iconHeight || 25; const width: number = props.iconWidth || 25; @@ -58,4 +58,4 @@ export const Rating: React.FunctionComponent = React.memo((props: R /> ); -}); +}; diff --git a/src/Slider/Slider.tsx b/src/Slider/Slider.tsx index 68ab83806..a38b01ff7 100644 --- a/src/Slider/Slider.tsx +++ b/src/Slider/Slider.tsx @@ -28,7 +28,7 @@ export interface SliderProps { reference?: React.RefObject; } -export const Slider: React.FunctionComponent = React.memo((props: SliderProps): React.ReactElement => { +export const Slider: React.FunctionComponent = (props: SliderProps): React.ReactElement => { const min: number = props.min ? props.min : 0; const max: number = props.max ? props.max : 100; @@ -107,4 +107,4 @@ export const Slider: React.FunctionComponent = React.memo((props: S ); -}); +}; diff --git a/src/Stepper/Stepper.tsx b/src/Stepper/Stepper.tsx index a94da8f54..34640efe0 100644 --- a/src/Stepper/Stepper.tsx +++ b/src/Stepper/Stepper.tsx @@ -16,7 +16,7 @@ export interface StepperProps { reference?: React.RefObject; } -export const Stepper: React.FunctionComponent = React.memo((props: StepperProps): React.ReactElement => { +export const Stepper: React.FunctionComponent = (props: StepperProps): React.ReactElement => { return (
{props.label && } @@ -40,4 +40,4 @@ export const Stepper: React.FunctionComponent = React.memo((props: {props.error &&
{props.error}
}
); -}); +}; diff --git a/src/TextArea/TextArea.tsx b/src/TextArea/TextArea.tsx index 03ce79fff..f820dbeb7 100644 --- a/src/TextArea/TextArea.tsx +++ b/src/TextArea/TextArea.tsx @@ -24,7 +24,7 @@ export interface TextAreaProps { reference?: React.RefObject; } -export const TextArea: React.FunctionComponent = React.memo((props: TextAreaProps): React.ReactElement => { +export const TextArea: React.FunctionComponent = (props: TextAreaProps): React.ReactElement => { return (
@@ -52,4 +52,4 @@ export const TextArea: React.FunctionComponent = React.memo((prop
); -}); +}; diff --git a/src/TextBox/TextBox.tsx b/src/TextBox/TextBox.tsx index 74d345a68..7c482dea8 100644 --- a/src/TextBox/TextBox.tsx +++ b/src/TextBox/TextBox.tsx @@ -23,7 +23,7 @@ export interface TextBoxProps { reference?: React.RefObject; } -export const TextBox: React.FunctionComponent = React.memo((props: TextBoxProps): React.ReactElement => { +export const TextBox: React.FunctionComponent = (props: TextBoxProps): React.ReactElement => { return (
@@ -51,4 +51,4 @@ export const TextBox: React.FunctionComponent = React.memo((props:
); -}); +}; diff --git a/src/TextBoxGroup/TextBoxGroup.tsx b/src/TextBoxGroup/TextBoxGroup.tsx index f52f650bf..af50b33af 100644 --- a/src/TextBoxGroup/TextBoxGroup.tsx +++ b/src/TextBoxGroup/TextBoxGroup.tsx @@ -34,7 +34,7 @@ export interface TextBoxGroupProps { reference?: React.RefObject; } -export const TextBoxGroup: React.FunctionComponent = React.memo((props: TextBoxGroupProps) => { +export const TextBoxGroup: React.FunctionComponent = (props: TextBoxGroupProps) => { return (
{props.label && } @@ -84,4 +84,4 @@ export const TextBoxGroup: React.FunctionComponent = React.me
); -}); +}; diff --git a/src/Toggle/Toggle.tsx b/src/Toggle/Toggle.tsx index ed7bcaa06..a30f7cb5c 100644 --- a/src/Toggle/Toggle.tsx +++ b/src/Toggle/Toggle.tsx @@ -10,7 +10,7 @@ export interface ToggleProps { reference?: React.RefObject; } -export const Toggle: React.FunctionComponent = React.memo((props: ToggleProps): React.ReactElement => { +export const Toggle: React.FunctionComponent = (props: ToggleProps): React.ReactElement => { return (
@@ -28,4 +28,4 @@ export const Toggle: React.FunctionComponent = React.memo((props: T {props.label &&
{props.label}
}
); -}); +}; diff --git a/src/Video/Video.tsx b/src/Video/Video.tsx index 78f8c24a2..51bf9fd55 100644 --- a/src/Video/Video.tsx +++ b/src/Video/Video.tsx @@ -15,7 +15,7 @@ export interface VideoProps { allowFullScreen?: boolean; } -export const Video: React.FunctionComponent = React.memo((props: VideoProps): React.ReactElement => { +export const Video: React.FunctionComponent = (props: VideoProps): React.ReactElement => { return (
{props.sourceType === "local" && @@ -49,4 +49,4 @@ export const Video: React.FunctionComponent = React.memo((props: Vid }
); -}); +};