React.SFC is deprecated
Closed this issue · 1 comments
oliviertassinari commented
/**
* @deprecated as of recent React versions, function components can no
* longer be considered 'stateless'. Please use `FunctionComponent` instead.
*
* @see [React Hooks](https://reactjs.org/docs/hooks-intro.html)
*/
type SFC<P = {}> = FunctionComponent<P>;
Here is one example:
The best resolution is probably to follow the definition style of the main repo:
diff --git a/lib/src/views/Calendar/CalendarHeader.tsx b/lib/src/views/Calendar/CalendarHeader.tsx
index 86174f9c..d7a2b96b 100644
--- a/lib/src/views/Calendar/CalendarHeader.tsx
+++ b/lib/src/views/Calendar/CalendarHeader.tsx
@@ -81,7 +81,8 @@ function getSwitchingViewAriaText(view: DatePickerView) {
: 'calendar view is open, switch to year view';
}
-export const CalendarHeader: React.SFC<CalendarHeaderProps> = ({
+export function CalendarHeader(props: CalendarHeaderProps) {
+ const = {
view: currentView,
views,
currentMonth: month,
@@ -99,7 +100,7 @@ export const CalendarHeader: React.SFC<CalendarHeaderProps> = ({
leftArrowButtonText = 'previous month',
rightArrowButtonText = 'next month',
getViewSwitchingButtonText = getSwitchingViewAriaText,
-}) => {
+} = props;
const utils = useUtils();
const classes = useStyles();
dmtrKovalenko commented
Fixed by #2045