Skip to content

Cannot embed bare do block in FormGroup component #11

@LeopoldArkham

Description

@LeopoldArkham

The following:

<FormGroup>
    <Label>Email</Label>
    <Input name="email" onChange={this._handleChange} />
    {do {
    if (this.state.showEmailEmpty) {
        <span>
        <br />This field cannot be empty
        </span>;
    }
    }}
</FormGroup>

fails with this error:
image

Moving the <span> tag outside of the do block solves the issue...:

<FormGroup>
    <Label>Email</Label>
    <Input name="email" onChange={this._handleChange} />
    <span>
    {do {
        if (this.state.showEmailEmpty) {
            "This field cannot be empty"
        }
    }}
    </span>
</FormGroup>

... as does removing the enclosing FormGroup

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