How to import libraries into codepen?

I am trying to finish the Front end development libraries certification, however I cannot import libraries like react and redux without getting errors

Uncaught SyntaxError: The requested module 'https://esm.sh/react-redux' does not provide an export named 'default' (at pen.js:83:8)

how do i solve this?

Settings → JS

The import you get on Codepen can be wrong. In this case, the package does not have a default export. One option is to use * and alias it.

import * as reactRedux from "https://esm.sh/react-redux";
console.log(reactRedux)

As an aside, I would suggest using Stackblitz or Codesandbox instead for framework/library code.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.