TypeError: machines.map is not a function
Machine
C:/Users/cyro.costa/Desktop/PokeBev/PokeBev/pokebev/src/components/Machine/Machine.tsx:15
12 | }, []);
13 |
14 | return (
15 |
| ^ 16 | {
17 | machines.map((machine: any) =>
{machine.move}
)
18 | }
View compiled
▶ 18 stack frames were collapsed.
(anonymous function)
C:/Users/cyro.costa/Desktop/PokeBev/PokeBev/pokebev/src/components/Machine/Machine.tsx:9
6 | const [machines, setMachines] = useState([]);
7 |
8 | useEffect(() => {
9 | fetch('https://pokeapi.co/api/v2/machine/')
| ^ 10 | .then((response) => response.json())
11 | .then((data) => setMachines(data));
12 | }, []);
View compiled
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error. Click the 'X' or hit ESC to dismiss this message.
Ao apertar no botão Machines na aplicação principal aparece a seguinte mensagem de error:
http://localhost:3000/Machine
TypeError: machines.map is not a function Machine C:/Users/cyro.costa/Desktop/PokeBev/PokeBev/pokebev/src/components/Machine/Machine.tsx:15 12 | }, []); 13 | 14 | return (