Line 9:6: React Hook React.useEffect has a missing dependency: 'init'. Either include it or remove the dependency array
const fetchBusinesses = useCallback(() => {
...
}, [])
useEffect(() => {
fetchBusinesses()
}, [fetchBusinesses])
import React, { useEffect, useState } from 'react';
import Todo from './Todo';
const TodoList = () => {
const [todos, setTodos] = useState([]);
useEffect(() => {
fetch('https://jsonplaceholder.typicode.com/todos')
.then(response => response.json())
.then(data => {
setTodos(data);
})
});
return (
<div>
{
todos.map(todo => (
<Todo
key={todo.id}
title={todo.title}
completed={todo.completed}
/>
))
}
</div>
)
}
export default TodoList;
Also in JavaScript:
- javascript es6 class
- js check proccess alive
- javascript write to file
- javascript troubleshooting with jest
- js get mic level
- reverse a number in javascript without using inbuilt function
- cJSON_CreateObject
- js change button text
- cli run js
- js generate list of names with forloop
- Discord.js Basics
- Javascript merge two objects
- replace comma by new line in js
- deep clone javascript object
- break loop after time javascript
- looping in javascript
- dynamodb get all items nodejs
- javascript enumerate
- app.router.navigate reset framework7
- access to model from js
- get url params angular
- parseint function javascript
- sum elements in list with same name js
- loopback UserModel.setter.password overwrite