Problems

Conditional Attribute Render

MediumJSX & Rendering

Render <button> with conditional attributes. Input JSON: {"label": string, "disabled": boolean, "variant": string|null}. Output <button class="btn btn-VARIANT" disabled>LABEL</button> — omit btn-VARIANT when variant is null and disabled when false.

Input: one JSON object. Output: the markup.

Your program reads from stdin and prints to stdout.

Example 1

Input: {"label":"Save","disabled":false,"variant":"primary"}

Output: <button class="btn btn-primary">Save</button>

Hints

ReactJSXAttributes