diff --git a/src/App.js b/src/App.js
index 99bd8f3..56518b5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -12,6 +12,7 @@ function App() {
const [search, setSearch] = useState('');
const [location, setLocation] = useState('');
const [isLoading, setIsLoading] = useState(false);
+ const [unit, setUnit] = useState('celsius');
function handleSearch(e) {
setSearch(e.target.value);
@@ -53,7 +54,7 @@ function App() {
}, [location, search, fetchData]);
let display = data ? (
-
+
) : (
no data found 😬
);
@@ -75,6 +76,9 @@ function App() {
+
diff --git a/src/components/Weather.js b/src/components/Weather.js
index c3685e6..d17a34c 100644
--- a/src/components/Weather.js
+++ b/src/components/Weather.js
@@ -1,3 +1,4 @@
+import React, { useState } from 'react';
import './Weather.css';
const Weather = (props) => {
@@ -8,7 +9,8 @@ const Weather = (props) => {
{props.data.condition.text}
- Temperature : {props.data.temp_c}°C
+
+ Temperature: {props.unit === 'celsius' ? props.data.temp_c : props.data.temp_f}° {props.unit === 'celsius' ? 'C' : 'F'}
Humidity : {props.data.humidity}
);