score:0
Accepted answer
you can put query = userinput
const handlesubmit = (event) => {
event.preventdefault();
axios({
url: "https://api.unsplash.com/search/photos",
method: "get",
dataresponse: "json",
params: {
client_id: "d54ve8fu6bjj_jgkbqugazot4bwfhgkmikdghunnxxc",
query: userinput,
per_page: 10,
},
}).then((response) => {
console.log(response.data.results);
setdata(response.data.results);
});
};
Source: stackoverflow.com
Related Query
- React axios api call with user input
- SetState with react hook and redux after async call to axios API
- handling user input in react to make an API call
- React - What is the correct way to make an API call with user input?
- Failed with code 405 when using axios to make a call to controller api in asp.net core react application
- Requesting user information from api with axios in react
- How to better way to send optional params in react JS with AXIOS Api call
- API call in react from user input
- Failed call to Deezer API with React and axios
- React redux update input field with user text after data filled from API
- Conditional API call using Axios with React Hooks
- Call API with React Redux, Axios
- How to use Axios to do a 2nd API get request call after componentDidMount, once the user interacts with your App?
- how to write one GET api call using axios instance with and without params in React JS
- MirageJs: cannot use axios if I call api with passthrough
- Using different API url for development and production with React and axios
- typescript react setState with user input
- React query mutation: getting the response from the server with onError callback when the API call fails
- React Hook useEffect : fetch data using axios with async await .api calling continuous the same api
- Call web api method inside ReactJS web worker with axios
- React useState hook not updating with axios call
- Why does React Hooks Axios API call return twice?
- What's the best practice to call API with react
- React hooks to manage API call with a timer
- React : make backend API call when user is authenticated, use LocalStorage if not
- React with Redux Axios get request error issue with laravel 5.2 api server
- React Server Side Rendering with expensive initial API call
- Make a second API call based on first api call response in React with hooks
- Problem with fetching API with user input
- React axios with PHP Rest API , how to write the baseurl
More Query from same tag
- How do you sort the results of a query in Realm-Web in React?
- React App works locally but getting Unexpected Token error in CodePen
- React js material ui Grid responsive
- In React how do I append a url from a database with https://
- ReduxForm inside Modal
- How "history" object is getting evaluated in React
- How can I use MUI pagination?
- Listen for scroll up / down?
- Need to render a document data with mongoose referenced document data on react.js+redux
- React testing library to cover the lazy load
- Convert string React Component to jsx again
- How to reorder map function in React
- React-Router v4 onEnter replacement
- Facebook ReactJS and Zurb Foundation for Apps?
- React Fontawesome doesn't have free-brands-svg-icons, so cant show the social media icons
- Enzyme- How to set state of inner component?
- defining a function to pass it as props, but I get a compiling error
- How to space around top tab bar in react native?
- React - Using componentDidUpdate to update state based on data passed from another function
- Change input values bases on other input onChange
- How to fix setState() gives the opposite value of checkbox?
- Return map() from a Firebase React Component?
- Comprhension about useState (React)
- Read rails encrypted credentials in webpacker react app
- Atlaskit DropdownItem list is showing under app bar
- React and Google's autocomplete Service and fetching zipcodes
- Call a function that triggers a service call on every state change
- React map not a function
- useState updates but changes doesnt show
- Focus effect on a DOM element in React