D
D
DaniilRuss2020-04-18 00:23:13
JavaScript
DaniilRuss, 2020-04-18 00:23:13

How to get status value from this.state.data?

constructor(props) {
    super(props)

    this.state = {
      data : [
        {
          key: 1,
          id: 1,
          name: 'Иван Иванов',
          status: true,
          feedback: 'Отличная работа, буду всем советовать',
        },
        {
          key: 2,
          id: 2,
          name: 'Петр Петров',
          status: false,
          feedback: 'Сделали круто, спасибо большое',
        },
      ] 
    }

this.columns = [
        { title: 'id', dataIndex: 'id', key: 'id' },
        { title: 'Имя', dataIndex: 'name', key: 'name' },
        { title: 'Отзыв', dataIndex: 'feedback', key: 'feedback' },
        {
          title: 'Статус',
          dataIndex: 'status',
          key: 'status',
          render: (record) => 
          record.status  // Проблема здесь 
          ? <Tag color="success">Активен</Tag>
          : <Tag color="default">Не активен</Tag>
        },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Somewhere Intech, 2020-04-18
@john36allTa

are you kidding me?))this.state.data[0].status

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question