can not add user input to the api

Here is the code and the cosole.log is showing the correct value of the city. value of the city is passing from another js file.

import React from 'react';
import  { useState,useEffect } from 'react';
import ReactDOM from 'react-dom';

const Content=(city)=>{

const [cities, setItems] = useState([]);

useEffect((city) => {
fetch(`${city},LK&mode=json ,appid=5c4420d5c8a61c16e5ee37e4ca265763`)
  .then(res => res.json())
    (result) => {
      setItems(cities => cities.concat(result));


 return (

export default Content;

I think the problem is with the ${city} but I tried everything that I know to solve it.

33 thoughts on “can not add user input to the api”

Leave a Comment