0

I have the following code in my render function where I'm trying to pass the user as props to the <Client /> component. When I check to see which props <Client /> received its only history, location and match. this.props.test = undefined

const users = this.state.users;
  return (
    <TableBody>
        {users.map((user, i) => {
          return (
            <TableRow key={i}>
              <TableCell>
                <Link to={`/Users/${user.name}`}>{user.name}</Link>
                <Route
                  path={`/Users/${user.name}`}
                  render={props => <Client {...props} test="hi" />}
                />
              </TableCell>
              <TableCell>{user.jobTitle}</TableCell>
              <TableCell>{user.company.name}</TableCell>
              <TableCell>{user.status}</TableCell>
            </TableRow>
          );
        })}
      </TableBody>
      )
serban
  • 48
  • 5
  • No need in `user` arg in render callback: `() => ` – iofjuupasli Nov 14 '18 at 13:11
  • ok, but it still doesnt solve my problem. here is how Client comp looks like `class Client extends React.Component { constructor(props) { super(props); } render() { console.log(this.props); const { name } = this.props.match.params; return
    {name}
    ; } } export default Client;`
    – serban Nov 14 '18 at 13:21

0 Answers0