fetchArea = (e) => {
this.setState(({ area }) => ({ area: e.target.value }));
console.log(new URLSearchParams({ input: this.state.area }).toString());
fetch(
`https://xegr-geography.herokuapp.com/places/autocomplete?` +
new URLSearchParams({ input: this.state.area }).toString(),
{
method: "GET",
mode: "no-cors",
headers: { "Content-Type": "application/json" },
params: { input: this.state.area },
}
)
.then((res) => res.json())
.then((data) => this.setState({ data: data }))
.catch((err) => console.log(err));
};
i am taking back "SyntaxError: Unexpected end of input" ! im trying to access this endpoint and search with an input type of 3 characters.