September 2018
Beginner
156 pages
3h 28m
English
React provides ref to get a reference to the rendered DOM element. This reference (ref) can then be used to perform certain operations outside the regular flow, such as focusing on the input element, media playback, and so on. <Link> is a composite component and it renders an anchor element on the DOM.
The <Link> component mentioned in the previous code snippet translates to anchor elements as follows:
..<nav> <a href="/">Home</a> <a href="/dashboard">Dashboard</a></nav>..
To get a reference to this rendered anchor element, the prop innerRef is added to <Link>:
<nav> <Link to="/" innerRef={this.refCallback}> Home </Link> <Link to="/dashboard" innerRef={this.refCallback}> Dashboard </Link></nav>
The innerRef prop accepts a ...
Read now
Unlock full access