Reputation: 1908
When I use a component like
const React = require('react');
const dns = require('dns');
class DnsResolver extends React.Component {
componentDidMount() {
dns.resolve('https://www.google.com', (err, addresses) => {
this.setState({
address: addresses
});
});
}
render() {
return (
<div>
{this.state.address}
</div>
);
}
}
module.exports = DnsResolver;
the result is 0.0.0.0
. Somehow, the browser cannot resolve the address. Why might this happen?
Upvotes: 1
Views: 666
Reputation: 2644
dns
is a native NodeJS module, it is intended to use in the server.
Upvotes: 2