komal deep singh chahal komal deep singh chahal - 4 months ago 125
React JSX Question

Router link giving warning " link is a void element tag and must not have `children` or use `props.dangerouslySetInnerHTML`."

I am using react-route first time.
when i am trying this, it gives me this warning and its not working
"Warning: link is a void element tag and must not have

children
or use
props.dangerouslySetInnerHTML
. Check the render method of Loginpanel."

my code is like this.

render() {

return (

<div >

<input type="email" />
<input type="password"/><br/>

<link to="Index"> BLOCK
</link>

</div>

)
}
}


and my main main.js is like this

render(
<Router history={hashHistory}>

<Route path="/" component={Loginpanel} >
<Route path="Index" component={App}/>
<Route path="Form" component={Form} />
</Route>


</Router>,
document.getElementById('js-main'));


Thanks in advance.

Answer

In reactjs its Link and not link. Can you try that once?

import {Link} from 'react-router';