如何将URL链接添加到警报?

时间:2019-01-10 06:22:08

标签: javascript reactjs antd

我正尝试在字符串中添加URL链接,但由于某种原因我无法显示它。是否可以将锚链接添加到警报?我正在使用antd显示警报。

enter image description here

class Settings extends PureComponent {
  state = {
    inValid:
      "This is a message because you haven't verified your email. If you haven't so, please click here to Verify Email`<a href=\"http://bing.com\">Bing</a>.`"
  };

  render() {
    const { inValid } = this.state;
    return (
      <AppLayout>
        <Container>
          <Row>
            <Alert
              message="Verify Email"
              description={inValid}
              type="warning"
              showIcon
            />
            <br />
            <SettingsTabs />
          </Row>
        </Container>
      </AppLayout>
    );
  }
}

1 个答案:

答案 0 :(得分:2)

根据documentationdescription属性接受stringReactNode。因此,您可以尝试定义一个ReactNode而不是一个包含string组件的Link,例如:

state = {
    inValid: (
        <div>This is a message because you haven't verified your email. If you haven't so, please click here to Verify Email <Link href="http://bing.com">Bing</Link>.</div>
    )
};