Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not render preview and submit button on React StrictMode #200

Open
Jason-CKY opened this issue Sep 29, 2022 · 6 comments
Open

Does not render preview and submit button on React StrictMode #200

Jason-CKY opened this issue Sep 29, 2022 · 6 comments

Comments

@Jason-CKY
Copy link

As mentioned in the title, it does not render preview and submit button when i run the code on React.StrictMode

@scd8418
Copy link

scd8418 commented Oct 14, 2022

I am having the same problem.

@fernandosmither
Copy link

Same

@aliMurtaja
Copy link

after spending a couple of hours.
I managed to solve this Issue.

all you need to update your state while uploading is running.
the state can be anything.

ex::

const [isUpdatePreview, setIsUpdatePreview] = useState(false)

<Dropzone
getUploadParams={getUploadParams}
classNames={{ inputLabelWithFiles: defaultClassNames.inputLabel }}
onChangeStatus={handleChangeStatus}
/>

now you need to update your state to tell react it does update the virtual DOM

const handleChangeStatus = ({ meta }, status) => {
    setIsUpdatePreview(!isUpdatePreview)
}

it will fix your Issue

@eclipse-cmd
Copy link

well, this works good

@nsshah14
Copy link

nsshah14 commented Mar 28, 2023

Hey @aliMurtaja, Your answer work for me as well. Just one thing, I am not able to remove the dropzone label after uploading files.

@raoufslv
Copy link

raoufslv commented Feb 7, 2024

@aliMurtaja thank you so much, it worked well !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants