Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Add new properties: classNames and styles #57

@scottmas

Description

@scottmas

After having programmed in React Native for two years and having finally returned to the web, I am horrified by all the boilerplate involved in conditionally applying styles. The pattern adopted by the community at large and by React Native is to iterate over an array of styles or classnames, filter out falsey values, and then merge the result. See the classnames package with over 4.5 million downloads for proof that this is a need in the community as well as the success of React Native and React Native Web which follow this pattern.

In order to maintain backwards compatibility, I propose keeping the properties style and className as specced, but then adding two additional properties styles and classNames which have the falsey filtering behavior described above. In the case both style and styles are defined on the component, the resulting objects would simply be merged with style taking precedence (similarly for className and classNames).

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