React Typescript. Issues populating an array state with an object

  1. Since you are using typescript, you should do the type definition or simply any
try const [usersData, setUsersData] = React.useState<any[]>([]);
React.useEffect(() => {
        setUsersData(result => [...result, ...data])
        props.setLoading(false);
}, []);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top