Я учусь на React, и я думал, что метод render
в React обязателен, но я видел следующий компонент:
export const GoogleButton = withStyles(theme => ({
root: {
height: 55,
width: 255,
margin: theme.spacing(5, 0, 2),
padding: theme.spacing(0, 1),
justifyContent: 'start',
background: theme.palette.background.default,
},
startIcon: {
marginRight: 20,
paddingRight: 3,
borderRight: `1px solid ${theme.palette.text.primary}`,
background: 'none',
},
}))(Button);
type AllProps = OwnProps & StateProps & DispatchProps;
export const GoogleLoginButtonPure = ({ isInProgress, login }: AllProps) => {
const handleClick = useCallback(() => login(), [login]);
const { t } = useTranslation();
return (
<GoogleButton
disabled={isInProgress}
onClick={handleClick}
fullWidth
variant="contained"
startIcon={GOOGLE_ICON}
>
{t('login.button')}
</GoogleButton>
);
};
Код работает без сбоев, но любой может объяснить мне, почему этот компонент делает нет render
метод?