# React/nextjs use Moralis as provider **Published by:** [N00b21337](https://paragraph.com/@n00b21337/) **Published on:** 2023-01-12 **URL:** https://paragraph.com/@n00b21337/react-nextjs-use-moralis-as-provider ## Content To use Moralis provider that is injected with wallet you need to load it into async function, good way to do that could be to put it into async functiona and call it when its convinient which would be when you connect with wallet. So we do this\ const getProvider = async () => { const provider = await Moralis.enableWeb3(); const myContract = new ethers.Contract(contractAddress, abi, provider); }; and then call it on useEffect when web3 is enabled. useEffect(() => { if (isWeb3Enabled) { getProvider(); } }, [isWeb3Enabled]); Another way is to import web3 asconst { isWeb3Enabled, web3 } = useMoralis(); and then use it asconst myContract = new ethers.Contract(contractAddress, abi, web3) ## Publication Information - [N00b21337](https://paragraph.com/@n00b21337/): Publication homepage - [All Posts](https://paragraph.com/@n00b21337/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@n00b21337): Subscribe to updates - [Twitter](https://twitter.com/0xCardinalError): Follow on Twitter