0

Please let me know if this is the right way to use modules on JavaScript

import React, { Component } from 'react';

import './App.css';

import logo from '../logo.png';

const ipfsClient = require('ipfs-http-client')

const ipfs = ipfsClient({host: 'ipfs.infura.io' , port:'5001', protocol : 'https'})

I am trying to link infura with IPFS and keep getting "TextDecoder is not a constructor" error, even though that does not seem to be the issue.

Kashif
  • 480
  • 4
  • 11
aj1719
  • 1
  • 1

1 Answers1

0

What versions of ipfs-http-client and react are you using? This was an issue with an older version of the http client paired with certain versions of react but it should be fixed in the latest release.

If in doubt, check the package.json for the relevant example and make sure your versions are aligned - https://github.com/ipfs/js-ipfs/tree/master/examples

achingbrain
  • 191
  • 2