Function lacks ending return statement and return type does not include 'undefined'. obserbavle<any> code example

Example: ReactElement Function lacks ending return statement and return type does not include 'undefined'.

const WarningSymbol = ({ state }: warningProps): ReactElement => {
    const useStyles = makeStyles(() => ({
        root: {},
        style: {
            color: '#e4e400',
            marginLeft: '-10px',
            marginTop: '2px',
        },
    }));
    const classes = useStyles();
    console.log('state', StateDTO[state]);
    if (state === StateDTO.ONLINE) {
        console.log('in if');
        return <WarningRoundedIcon classes={{ root: classes.style }} />;
    }
};

export default WarningSymbol;