skip to Main Content

Why is app fetching on input change in react? – Reactjs

import './App.css'; import Axios from 'axios'; import {useState} from 'react'; function App() { const [name, setName] = useState(''); const fetchData = () => { Axios.get(`https://api.agify.io/?name=${name}`).then((res)=> { console.log(res.data) }) } return ( <div className="App"> <input placeholder='Ex. John' onChange={(e)=> {setName(e.target.value)}}></input> <button onClick={fetchData()}>Predict…

VIEW QUESTION

Can't build React project at CloudFlare Pages – Reactjs

Believe me, I don't have any idea about this and I can share the error with you: Compiled with problems: ERROR in ./node_modules/@react-spring/core/dist/index.mjs 1596:0-45 Module not found: Error: Can't resolve '@react-spring/types/animated' in '/Users/oguzhantufenk/Desktop/Siblings projects/Barbearians-Front-End/node_modules/@react-spring/core/dist' Did you mean 'animated.js'? BREAKING CHANGE:…

VIEW QUESTION

How to use switch case in React? – Reactjs

const Calculatorpage = () => { function calculate() { const firstNum = Number(document.getElementById('firstNum').value) const secondNum = Number(document.getElementById('secondNum').value) const symbol = document.getElementById('symbol').value const result = document.getElementById('result') console.log("im in"); let res switch (symbol) { case "+": res = secondNumber + firstNumber break;…

VIEW QUESTION
Back To Top
Search