Search code examples
javascriptreactjsreact-hooksreact-final-form

GETTING ERROR : Warning: Failed prop type: Invalid prop `children` supplied to `Form`, expected a ReactNode


I am making a simple demo of useContext using final-form.I am getting this warning

Warning: Failed prop type: Invalid propchildrensupplied toForm, expected a ReactNode.

here is my code https://codesandbox.io/s/github/test-gitt

step to reproduce my issue or warning

  1. run the application .A button is displayed . Click on button.it shows another page having a button.
  2. click again the button with console open contrl+alt+I.

you will this warning why ?

<BrowserRouter>
        <LoadingProvider>
            <Router/>
        </LoadingProvider>
    </BrowserRouter>

enter image description here

any update ?


Solution

  • From what I was able to test using your provided code, this is what took that error away:

    On the following line of code inside src > add-agency > index.js:54

    You have to wrap the children of SForm into a Fragment in order for the children to be only one ReactNode. Something like:

    <SForm>
        <Fragment>
            <Tag />
            <Tag />
            <Tag />
        </Fragment>
    </SForm>

    Please consider not posting your entire code base and just write down a simple and reproducible example that can easily show what issue you're trying to figure out.