Skip to content

Super expression must either be null or a function, not undefined #211

@jordan-ghost

Description

@jordan-ghost

I am unable to work around this error when I import and use this package in a NextJS static build project. It behaves as if React.Component is not available. It seems Class components are disfavoured in recent versions of React, but not deprecated, and at any rate react-headroom specifies react@^18, so I am confused why this causes a problem here. Any advice would be welcome, thankyou.

Minimal reproduction

import { Headroom } from "react-headroom"

export default function MyThing () {
  return (
    <Headroom>
      <h1>My Thing</h1>
    </Headroom>
  )
}
  • Also happens when importing default (import Headroom from "react-headroom")
  • Doesn't happen if the component is imported but not used

More Context

  • Using Typescript/tsx
  • Yarn PM
  • react@18.2.0
  • next@13.4.3
  • react-headroom@3.2.1
  • typescript@5.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions