Skip to content
Snippets Groups Projects
Commit d7989656 authored by zh393's avatar zh393
Browse files

fixed minor bug where when user starts typing, the website displays no...

fixed minor bug where when user starts typing, the website displays no ingredients found when it's actually loading the suggested ingredients
parent 387d89fc
No related branches found
No related tags found
No related merge requests found
......@@ -2,17 +2,15 @@ import React, { useState } from 'react'
import TextField from '@mui/material/TextField';
import { Stack } from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
var axios = require("axios").default;
function SearchBar(props) {
const [suggestions, setSuggestions] = useState([])
const [items, setItems] = useState("")
let items = [];
const handleChange = (event) => {
setItems(event.target.value)
var axios = require("axios").default;
items = event.target.value;
var options = {
method: 'GET',
url: 'https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/food/ingredients/autocomplete',
......@@ -28,10 +26,8 @@ function SearchBar(props) {
}).catch(function (error) {
console.error(error);
});
}
const handleSubmit = (event, value) => {
event.preventDefault()
if (value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment