Error: 'Link' is not defined react/jsx-no-undef in React
Dung Do Tien
Jan 23 2021
574
I create a simple component form with Reactjs but I got an error: 'Link' is not defined react/jsx-no-undef
App.js
file:
import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<h1>hello</h1>
<Link to="/home">Back to home page</Link>
</div>
);
}
}
export default App;
Thank you many for any solution.
Have 1 answer(s) found.
-
m0
majid gholipour Jan 23 2021
<Link>
tag object does not default available, you need to import it before use by add command below to head of yourApp.js
file:import { Link } from 'react-router-dom';
Happy code!!!
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.