Skip to content

Error: A React Element from an older version of React was rendered when using React 19 #580

@Artur-

Description

@Artur-
  • Check if updating to the latest version resolves the issue

Environment

  • I am using @preact/signals-core
  • I am using @preact/signals
  • I am using @preact/signals-react

Describe the bug
A simple signal using component

import { signal } from "@preact/signals-react";

const mySignal = signal("world");

export default function BasicSignalView() {
  return <span>Hello: {mySignal}</span>;
}

fails with React 19 rc with

Error: A React Element from an older version of React was rendered. This is not supported. It can happen if:
- Multiple copies of the "react" package is used.
- A library pre-bundled an old copy of "react" or "react/jsx-runtime".
- A compiler tries to "inline" JSX instead of using the runtime.

To Reproduce

Steps to reproduce the behavior:

https://github.com/Artur-/react19-signals-tests-babel

npm i --legacy-peer-deps
npm run dev

open http://localhost:5173/

Expected behavior
It should show "Hello: world" like with React 18

  return <span>Hello: {mySignal.value}</span>;

also works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions