fix typescript weirdness while migrating from material v4

This commit is contained in:
Aria Moradi
2021-09-09 18:37:23 +04:30
parent 0869bb888f
commit 3154247300
4 changed files with 4 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ const useStyles = makeStyles({
interface IProps {
manga: IMangaCard
}
const AnimeCard = React.forwardRef((props: IProps, ref) => {
const AnimeCard = React.forwardRef<HTMLDivElement, IProps>((props: IProps, ref) => {
const {
manga: {
id, title, thumbnailUrl,
@@ -60,7 +60,6 @@ const AnimeCard = React.forwardRef((props: IProps, ref) => {
return (
<Grid item xs={6} sm={4} md={3} lg={2}>
<Link to={`/anime/${id}/`}>
{/* @ts-ignore */}
<Card className={classes.root} ref={ref}>
<CardActionArea>
<div className={classes.wrapper}>

View File

@@ -22,7 +22,7 @@ export default function AnimeGrid(props: IProps) {
mangas, message, hasNextPage, lastPageNum, setLastPageNum,
} = props;
let mapped;
const lastManga = useRef<HTMLInputElement>();
const lastManga = useRef<HTMLInputElement>(null);
const scrollHandler = () => {
if (lastManga.current) {

View File

@@ -66,7 +66,7 @@ const truncateText = (str: string, maxLength: number) => {
interface IProps {
manga: IMangaCard
}
const MangaCard = React.forwardRef((props: IProps, ref) => {
const MangaCard = React.forwardRef<HTMLDivElement, IProps>((props: IProps, ref) => {
const {
manga: {
id, title, thumbnailUrl,
@@ -78,7 +78,6 @@ const MangaCard = React.forwardRef((props: IProps, ref) => {
return (
<Grid item xs={6} sm={4} md={3} lg={2}>
<Link to={`/manga/${id}/`}>
{/* @ts-ignore */}
<Card className={classes.root} ref={ref}>
<CardActionArea>
<div className={classes.wrapper}>

View File

@@ -22,7 +22,7 @@ export default function MangaGrid(props: IProps) {
mangas, message, hasNextPage, lastPageNum, setLastPageNum,
} = props;
let mapped;
const lastManga = useRef<HTMLInputElement>();
const lastManga = useRef<HTMLDivElement>(null);
const scrollHandler = () => {
if (lastManga.current) {