[英]Using react-dropzone with nextjs - input with type “file” multiple property stuck on false for server render, how can I set it to true?
我在nextjs項目上使用react-dropzone,目前當我在服務器上渲染一個dropzone組件時,我得到了錯誤:
“index.js:2178警告:支持multiple
不匹配。服務器:”false“客戶端:”true“
我已嘗試在組件上設置multiple = {true}但沒有運氣。 但是,當我在組件上設置multiple = {false}時,客戶端渲染工作正常但已禁用多文件上載(如預期的那樣)
關於為什么它不能使用多個= {true}進行完整服務器渲染的任何想法?
React,NextJS項目與react-dropzone
嘗試在組件上設置multiple = {true}。 嘗試重建項目。
設置multiple = {false}有效但禁用所需的功能。
<Dropzone multiple={true} onDrop={this.onDrop}>
{({ getRootProps, getInputProps }) => (
<StyledDropzone>
<DropPoint {...getRootProps()}>
<input {...getInputProps()} />
<p>Drag and drop some images to upload</p>
</DropPoint>
<FilePreviewer>
<Thumbs>{thumbs}</Thumbs>
</FilePreviewer>
</StyledDropzone>
)}
</Dropzone>
對於SSR,將其設置為本機元素:
<input {...getInputProps()} multiple />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.