0
Hello, I’m trying to use the component Link
of react-router-dom
to generate links in a data table, however, I am facing the following problem:
Warning: validateDOMNesting(...): <a> cannot appear as a descendant of <a>
The code
function mapStateToProps(state) {
return {
pages: state.pages.map((page, index) => {
let dropdownBtnOpts = [{
text: 'Editar',
to: '/admin/pages/' + page._id + '/edit',
icon: 'edit'
}, {
text: 'Excluir',
icon: 'delete',
onClick: () => {
handleDeletePage(page._id)
}
}];
page._id = page._id.toString();
page.title = page.title;
page.url = <Link to={page.url}>{page.url}</Link>;
page.published = page.published;
page.actions = <DropdownButton state='default' size='small' options={dropdownBtnOpts}>Opções</DropdownButton>;
return page;
})
};
}
My problem is on the line:
page.url = <Link to={page.url}>{page.url}</Link>;
The result is something like:
<Link to=''>
<Link to='/url'></Link>
</Link>
Some clarification will be welcome, thank you.