将 React Dropzone 与 React Final Form 一起使用
Using React Dropzone together with React Final Form
试图弄清楚如何一起使用这两个组件。人们指的是 an issue on github 和 运行,但我想不通。它的要点是这样的:
<Field name={`logo`}>
{(fieldprops) => (
<div>
<label>Logo</label>
<Dropzone
onDrop={(files, e) => {
props.change(`logo`, files);
props.blur(`logo`);
}}
/>
<pre>{JSON.stringify(fieldprops, 0, 2)}</pre>
</div>
)}
</Field>
使用那个确切的代码会为我抛出错误:TypeError: children is not a function
我在文档中的 Code Sandbox that uses hooks and file preview. I also tried looking at custom inputs 上设置了一个简化的测试用例,但似乎缺少某些东西才能正常工作。如果有人能指出正确的方向,我会非常高兴。
试图弄清楚如何一起使用这两个组件。人们指的是 an issue on github 和 运行,但我想不通。它的要点是这样的:
<Field name={`logo`}>
{(fieldprops) => (
<div>
<label>Logo</label>
<Dropzone
onDrop={(files, e) => {
props.change(`logo`, files);
props.blur(`logo`);
}}
/>
<pre>{JSON.stringify(fieldprops, 0, 2)}</pre>
</div>
)}
</Field>
使用那个确切的代码会为我抛出错误:TypeError: children is not a function
我在文档中的 Code Sandbox that uses hooks and file preview. I also tried looking at custom inputs 上设置了一个简化的测试用例,但似乎缺少某些东西才能正常工作。如果有人能指出正确的方向,我会非常高兴。