score:0
yes, it is ok to use onchange
on dragger
if you are already not using in its props. and in the given example there is already onchange
property in props
object that you are passing to dragger
, so you should not use another onchange attribute instead you can write your logic inside onchange
property of props
object
const { dragger } = upload;
const props = {
name: 'file',
multiple: true,
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
//here is onchange function written and you can use this to perform your action
onchange(info) {
const { status } = info.file;
if (status !== 'uploading') {
console.log(info.file, info.filelist);
}
if (status === 'done') {
message.success(`${info.file.name} file uploaded successfully.`);
} else if (status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
},
};
.
.
.
<dragger {...props}>
<p> ... </p>
</dragger>
Source: stackoverflow.com
Related Query
- how to use onChange attribute in dragger tag?
- How to use selected attribute of select tag in a loop in React
- React Formik : how to use custom onChange and onBlur
- React hook form: How to can I use onChange on React Hook Form Version 7.0
- How to use onChange method in semantic react dropdown
- How to use FormattedMessage inside an option tag in React 0.14?
- How to use onchange with autocomplete material ui?
- How to use babel directly from a script tag without installing babel itself
- How to use Video html tag instead of img tag in material-ui Card Component
- how to use useRef for the attribute htmlFor?
- How to add lang attribute to html tag in Next.js?
- Next.js - How to add a <link> tag inside the <head> with literal onload attribute string value?
- React - how to use hooks to hide or show a component based on an onChange event
- how to use the Google Tag Manager plugin for gatsby?
- How do I use debounce in Input onChange events in TypeScript
- ReactStrap modal close icon is not getting show in the modal and How to use the header with some another tag
- React use of HTML5 video tag controlsList attribute
- How to use onChange in react-select
- How to validate type "target.dataset" attribute of input tag in typescript
- How to retrieve data from custom attribute on option tag in React
- how to use onChange on array of objects to add data in ReactJS
- How to capture the backspace event in onChange tag of Form for Reactjs applications
- How to use useCallback hook with onChange function REACT
- how to use attribute name including colon in jsx
- How to use onChange with react hook on react select to change data base on user select
- React Formik : how to use custom function onChange and onConfirmChange for request input
- How Can I use the returned string (new feature of React v16.0.0) in the source tag of an image ex: <img src='returnedString' />?
- How to add attribute to HTML tag passed in props- before render?
- How to use an Electron <webview> tag in TypeScript?
- How to use usecallback method in onchange handler using react and typescript?
More Query from same tag
- React js - calling a function in render works BUT in componentDidMount doesn't
- Prevent fetching when component re-renders
- Material ToolTip which gets its text from parent (anchor)
- Tests with MaterialUI failing because of styles
- Warning when using a component from a variable
- How to properly copy dynamic content in reactjs
- Accessing JSON returns undefined
- React preview images after inserting input type files
- Is this a correct approach to populate the properties of an App Context in React?
- How to get result from async function within synchronous function in typescript?
- Meteor & React Unexpected token
- Disable Snackbar animation [Material-ui]
- Uncaught Error: @electron/remote is disabled for this WebContents
- Redux toolkit running multiple queries even with preventing it
- Fetching data from Firebase with react
- eslint-plugin-jsx-a11y for Typescript
- Importing Public Folder Images In Src Css Files In Reactjs
- Create React App production build succeeds but produces code with errors
- Comparing and updating the fields in firebase database
- How to optimize the re-rendering of large amounts of child components?
- ReferenceError: window is not defined in getServerSideProps for Next.js App And I Need to Store A Variable Persistantly in The getServerSideProps Func
- Material-ui hoverColor for MenuItem component?
- How to add styles to an unknown child in React with Material-UI?
- React - setState in child through props
- How do you pass data out of a React component using a callback?
- Create React Context that returns 2 Other Functions Through Context Provider
- ReactJS: "SyntaxError: Unexpected token "
- Filter in react query not working properly on first attempt
- Prop to detect if link is active in react
- How to highlight text based on user input with React?