Search code examples
javascriptreactjswebpacknext.jsbabeljs

Next.js 13 (App directory: TypeError: Cannot read properties of undefined (reading 'prototype')


I wanted to add downshift library. When I copied an example of basic usage from GitHub, an error occured.

Versions: Next.js: 13.2.4 React: 18.2.0

As soon as I understand, it's a kind of babel issue. The code of component that causes the error is just a basic usage example from downshift GitHub (link above).

enter image description here


Solution

  • Select component should be client component.

    https://beta.nextjs.org/docs/rendering/server-and-client-components

    Add "use client" directive to the downshift select file.