Skip to content

Preact is constantly remounting subcomponents #857

@youknowriad

Description

@youknowriad

While trying to migrate from React to preact, we noticed some mounting/rerendering issues;
Not sure if you consider this as a bug or not, but compared to react there's a difference in the way preact decides which component got dropped and which one got reordered when two siblings have the same type but not the same children.

Code examples are clearer:

Notice that the subcomponent in the preact version is constantly remounting, if we hide/show the previous <div> while it's mounted only once in React. I found a workaround by setting a key prop to identify the <div>s.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions