D
D
Dementor032022-03-17 19:22:36
JavaScript
Dementor03, 2022-03-17 19:22:36

How to pull value from fetchedUser.id?

Hello. I am writing an application for Vk. I need to get the value from fetchedUser.id in a variable.
What would then place this value in if.

The code:

import React from "react";

import PropTypes from 'prop-types';

import {Panel, PanelHeader, Header, Group, Cell, Avatar,} from '@vkontakte/vkui';





const Home = ({ id, go, fetchedUser }) => (

  <Panel id={id}>
    <PanelHeader>Example</PanelHeader>
    {fetchedUser &&
    <Group header={<Header mode="secondary">Example</Header>}>
      <Cell
        before={fetchedUser.photo_200 ? <Avatar src={fetchedUser.photo_200}/> : null}
        description={fetchedUser.city && fetchedUser.city.title ? fetchedUser.city.title : ''}
      >
        {`${fetchedUser.first_name} ${fetchedUser.last_name} ID: ${fetchedUser.id}`}
      </Cell>
    </Group>}
    <Group header={<Header mode="secondary">Navigation Example</Header>}>



    </Group>
  </Panel>
);

Home.propTypes = {
  id: PropTypes.string.isRequired,
  go: PropTypes.func.isRequired,
  fetchedUser: PropTypes.shape({
    photo_200: PropTypes.string,
    first_name: PropTypes.string,
    last_name: PropTypes.string,
    city: PropTypes.shape({
      title: PropTypes.string,
    }),
  }),
};

export default Home;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question