Created
June 19, 2019 02:05
-
-
Save andycarrell/03e651d4c8f372bcce4332c19179277b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import { MockedProvider } from "react-apollo/test-utils"; | |
const ReRenderMockedProvider = ({ children, mocks }) => { | |
const [key, setKey] = useState(Date.now()); | |
useEffect(() => { | |
setKey(Date.now()); | |
}, [mocks]); | |
return ( | |
<MockedProvider key={key} mocks={mocks}> | |
{children} | |
</MockedProvider> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment