score:3
Accepted answer
use axios api to call api and fetch data
onkeyup(e) {
axios.get('/seachdata?keywords='+e.target.value)
.then(function (response) {
this.setstate({autosearchresponse: response.data})
})
.catch(function (error) {
console.log(error);
});
}
search data set in this.state.autosearchresponse you can use autosearch response as html
{this.state.autosearchresponse.map((value, i)=>
<div key={i}>{value}</div>
)}
bind onkeyup function to input
Source: stackoverflow.com
Related Query
- React send AJAX request inside input onChange
- React: How to add onChange functionality inside of Function component using React Hooks? Need onClick event from a checkbox to influence input state
- React onChange not working for input inside functional component
- React - How to Populate and Show a Modal, then Send AJAX Request on Submit
- Best practice for validating input while onChange inside React custom hook?
- React Formik : how to use custom function onChange and onConfirmChange for request input
- Put cursor inside input box onChange in React
- Pass input value to AJAX request in React
- take a csv file as input from user using React and send it as a post request using axios
- How to send request from react app inside nginx which is inside docker container to golang webservice which is inside docker container on same AWS EC2
- React - How to print the value of an input onChange inside the component
- Why can't I change my input value in React even with the onChange listener
- Why can't I change my input value in React even with the onChange listener
- How to send request on click React Hooks way?
- React input onChange lag
- React prevent form submission when enter is pressed inside input
- React + Redux - Input onChange is very slow when typing in when the input have a value from the state
- How do I store JWT and send them with every request using react
- React Hooks - Making an Ajax request
- Uncaught TypeError: create is not a function using useEffect React Hook with AJAX request
- Can I send an AJAX call in React and Redux without action creators and reducers?
- React input onChange won't fire
- Send cursor to the end of input value in React
- TypeScript & React - one onChange Handler for multiple input fields
- Why ajax request should be done in componentDidMount in React components?
- Typescript & React Component that accepts onChange for both TextArea and Input
- React input type file onChange not firing
- Can I set an input field to readonly in React while keeping my onChange function?
- How to make React input onChange set state only after onChange stops firing for set time?
- React change input value onChange
More Query from same tag
- Handling click events of links rendered within markdown React component
- TypeError: date[("get" + method)] is not a function in React-big-calendar
- OnClick react Button to show table
- Can't divide Logged In screens and Logged out ones in React Router + FIrebase
- Mailgun Attachment + Axios
- React-query library - how to make optimistic updates typed with TS?
- How to use multi-entry and history-mode react-router at the same time?
- Router is not defined in index.js
- onSubmit is not executing async function
- Ignore click on transparent parts of images
- Jest unit test for moment specific format
- Why is my URL [object%20Object] in API call?
- Show protected image from API to Next.js client in an img tag
- React Router v5: history.push() changes the address bar, but does not change the page
- React HOC to handel child component API failure
- useState doesn't work when I use it with other function in onClick
- (JavaScript, Redux) Why are my nested array's getting deleted when returning, however when I don't return it doesn't?
- react | redux-form | material-ui | how to combine DatePicker with my form
- Should a key be directly on your component or on the container element within your component?
- how to use the useEffect hook on component unmount to conditionally run code
- How can I change multiple Checkboxes in React Hook Form Via state
- How to iterate through array inside objects which is inside main object
- Emit multiple actions within catchError - Redux Observable
- ReactJs: Control flow in nested components
- Implementing React Dropdown menu
- Why props in React are read only?
- what is the right way to use Google's ClientId with useGoogleLogin Hook?
- CSS diagonal gradient with a more smooth transit
- Why is a ReactJS component using Hooks rendered once or twice depending on developer console is open or not?
- Typescript: fetch file from API and read it's original filename