Skip to content

defaultProps incorrectly applied when passing null #4774

@vpzomtrrfrt

Description

@vpzomtrrfrt
  • Check if updating to the latest Preact version resolves the issue

Describe the bug
Passing null as a prop value to a component using defaultProps doesn't work, and the default is set instead

To Reproduce

https://codesandbox.io/p/sandbox/defaultprops-test-preact-t44j84

Steps to reproduce the behavior:

  1. Open the page

Expected behavior
The second component should show nothing, not "bar", which is what happens in 10.26.4 and earlier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions