Skip to content

A generalized link <a> component that allows client-side navigation while taking into account exceptions.

License

Notifications You must be signed in to change notification settings

thinkloop/link-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Link (React)

A generalized link <a> component that allows client-side navigation, while ignoring:

  • shift-clicking
  • alt-clicking
  • ctrl-clicking
  • non-left clicking
  • target attribute
  • mailto href

Install

npm install link-react --save

React itself is a peer dependency and not included, it is the responsibility of the implementing app to provide a reference to React.

Use

import React from 'react';
import Link from 'link-react';

export default (p) => (
	<nav>
		<Link href={ p.homeLink.href } onClick={ p.homeLink.onClick }>{ p.homeLink.label }</Link>
		<Link href={ p.aboutLink.href } onClick={ p.aboutLink.onClick }>{ p.aboutLink.label }</Link>
	</nav>
);

License

Released under an MIT license.

Related

Other

Like it? Star It

About

A generalized link <a> component that allows client-side navigation while taking into account exceptions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published