Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
78
rated 0 times [  80] [ 2]  / answers: 1 / hits: 45333  / 9 Years ago, fri, november 27, 2015, 12:00:00

I'm building a React app that has links pointing to predefined routes.



<a href=/my/react/route/>Click Here</a>


The routes resolve fine, but it's refreshing the page, thereby slowing down app performance. How do I avoid re-rendering the entire page?


More From » reactjs

 Answers
22

Fix the problem by using the <Link> tag included with react-router.



import React from react;
import { Link } from 'react-router-dom';

export class ToolTip extends React.Component {
render() {
return (
<Link to=/My/Route>Click Here</Link>
)
}
};

[#64246] Wednesday, November 25, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stacie

Total Points: 476
Total Questions: 92
Total Answers: 102

Location: Bosnia and Herzegovina
Member since Tue, Mar 29, 2022
2 Years ago
stacie questions
Fri, Jun 26, 20, 00:00, 4 Years ago
Thu, Jan 23, 20, 00:00, 4 Years ago
Fri, Aug 30, 19, 00:00, 5 Years ago
Fri, Aug 2, 19, 00:00, 5 Years ago
;