Search code examples
reactjsrecoiljs

Is there a way to initialize multiple atom states before testing a component in react-testing -library?


Right now I am initializing a single atom state as follows

<RecoilRoot initializeState={(snap: any): any => snap.set( oneTimeData, onetimeParameter)}>

I am trying to add another atom errors to the above code.

<RecoilRoot initializeState={(snap: any): any => snap.set( (oneTimeData, onetimeParameter), (errors, errorsParameter) }>

Is this the correct usage?


Solution

  • I offer this edit:

    <RecoilRoot initializeState={(snap: any): any => {snap.set( oneTimeData, onetimeParameter);
    snap.set(errors, errorsParameter);}}>