Skip to content

Local variables declaration #1

Description

@VladimirMilenko

Dynamic programming task

const badgeClasses = cn(styles[`cr-badge`], {
    [styles[`${baseClass}--default`]]: !(success || danger || info || important || warning),
    [styles[`${baseClass}--success`]]: success,
    [styles[`${baseClass}--danger`]]: danger,
    [styles[`${baseClass}--info`]]: info,
    [styles[`${baseClass}--important`]]: important,
    [styles[`${baseClass}--warning`]]: warning,
    [styles[`${baseClass}--small`]]: small,
    [styles[`${baseClass}--pill`]]: pill,
  });

When it comes, to variable declaration, you basically face dynamic programming problem. You don't know exactly how to convert badgeClasses, but you know, how to convert other variables.
So, on some step you will face trivial problem, when variable is going to be declared as is.

Like, for badgeClass you will face success variable, which is coming from props.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions