-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintcache
1 lines (1 loc) · 4.1 KB
/
.eslintcache
1
[{"C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\index.js":"1","C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\App.js":"2","C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\reportWebVitals.js":"3","C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\Recipe.js":"4"},{"size":500,"mtime":499162500000,"results":"5","hashOfConfig":"6"},{"size":1424,"mtime":1608395795934,"results":"7","hashOfConfig":"6"},{"size":362,"mtime":499162500000,"results":"8","hashOfConfig":"6"},{"size":708,"mtime":1609505962330,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},"1vq2f9o",{"filePath":"13","messages":"14","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"15","usedDeprecatedRules":"12"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\index.js",[],["20","21"],"C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\App.js",["22","23"],"import React, {useEffect, useState} from \"react\";\nimport Recipe from \"./Recipe\";\nimport './App.css';\n\nconst App = () => {\n\nconst APP_ID =\"f907f10a\";\nconst APP_KEY =\"59a664b0a9590ff8c0531f9ff320a7a9\";\n\n\nconst [recipes, setRecipes] = useState([]);\nconst [search, setSearch] = useState('');\nconst [query, setQuery] = useState('chicken');\n\n//use effect\n\n\n\nuseEffect( async () =>{\n getRecipes();\n\n}, [query]);\n\nconst getRecipes = async () => {\n const response = await fetch(`https://api.edamam.com/search?q=${query}&app_id=${APP_ID}&app_key=${APP_KEY}`);\n const data = await response.json();\n setRecipes(data.hits);\n console.log(data.hits);\n};\n\nconst updateSearch = e => {\n setSearch(e.target.value);\n};\n\nconst getSearch = e => {\n e.preventDefault();\n setQuery(search);\n setSearch('');\n}\n\n return(\n <div className=\"App\">\n <form onSubmit={getSearch} className=\"search-form\">\n <input className=\"search-bar\" type=\"text\" value={search} onChange={updateSearch}/>\n <button className=\"search-button\" type=\"submit\">Search</button>\n </form>\n <div className=\"recipes\">\n {recipes.map(recipe => (\n <Recipe\n key= {recipe.recipe.label}\n title ={recipe.recipe.label} \n calories = {recipe.recipe.calories}\n image={recipe.recipe.image}\n ingredients={recipe.recipe.ingredients}\n />\n ))}\n </div>\n </div>\n );\n}\n\n\n\nexport default App;\n","C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\reportWebVitals.js",[],"C:\\Users\\developer\\Desktop\\React-recipe-app\\my-recipe-app\\src\\Recipe.js",[],{"ruleId":"24","replacedBy":"25"},{"ruleId":"26","replacedBy":"27"},{"ruleId":"28","severity":1,"message":"29","line":19,"column":12,"nodeType":"30","endLine":22,"endColumn":2},{"ruleId":"28","severity":1,"message":"31","line":22,"column":4,"nodeType":"32","endLine":22,"endColumn":11,"suggestions":"33"},"no-native-reassign",["34"],"no-negated-in-lhs",["35"],"react-hooks/exhaustive-deps","Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching","ArrowFunctionExpression","React Hook useEffect has a missing dependency: 'getRecipes'. Either include it or remove the dependency array.","ArrayExpression",["36"],"no-global-assign","no-unsafe-negation",{"desc":"37","fix":"38"},"Update the dependencies array to be: [getRecipes, query]",{"range":"39","text":"40"},[396,403],"[getRecipes, query]"]