I have this table:
<Table hover bordered striped responsive size="sm">
<thead>
<tr>
<th>Nom du fichier</th>
<th>Date et heure d'ajout</th>
</tr>
</thead>
<tbody>
{this.state.fichierJointsInformation.map(
(operationSavInformation, i) => {
return (
<tr key={i}>
<td>
<Link
to={""}
onClick={this.onFichierJointLinkClicked}
>
{operationSavInformation.nomFichierOriginal}
</Link>
</td>
<td>{operationSavInformation.createdAt}</td>
</tr>
);
}
)}
</tbody>
</Table>
What I am trying to implement: When the user clicks on any element of the first column, the associated file gets downloaded.
So the onFichierJointLinkClicked onClick listener, will take care of the API request and everything else.
<Link
to={""}
onClick={this.onFichierJointLinkClicked}
>
{operationSavInformation.nomFichierOriginal}
</Link>
MY PROBLEM: The to prop in LINK is required. However, I don't want to route the user to any other page. I just want the onFichierJointLinkClicked to be triggered.
If I remove the to prop, I get this error obviously:
index.js:1 Warning: Failed prop type: The prop `to` is marked as required in `Link`, but its value is `undefined`.
