Is there any way to customize the error message?
Closed this issue · 3 comments
yazovsky commented
I would like to configure my own title and message when I initialize the Web3Provider component. Something like:
ReactDOM.render(
<Web3Provider message={"You don't have MetaMask installed. Here is our instruction how to do that"}>
<App />
</Web3Provider>,
document.getElementById('root')
);
Is there any way around to edit ErrorTemplate's props from my application?
yazovsky commented
ahhh. Sorry creating this issue. I figured how to do that. Please close:
const err = ErrorTemplate.bind(null, {
title: 'My custom title',
message: 'My custom message'
});
ReactDOM.render(
<Web3Provider web3UnavailableScreen={err}>
<App />
</Web3Provider>,
document.getElementById('root')
);
I guess, my question is -- is that the right way to do it? If so, then I could send a pull request to update the documentation.
Chococoin commented
Hi yazovsky,
I'm trying that solution but I've got...
Failed to compile.
./src/index.js
Line 8: 'ErrorTemplate' is not defined no-undef
Search for the keywords to learn more about each error.
Could you explain to us how you did your work around? Thank you.
coopermaruyama commented
@yazovsky FYI, you can actually pass in a react component like:
const myScreen = <div>no web3 available!</div>;
<Web3Provider web3UnavailableScreen={myScreen}>