1.0.0 • Published 4 years ago

element-or-link v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

element-or-link

A simple React component to render a hyperlink (using react-routers <Link />) or any html element depending on if a to prop is provided.

Example: https://codesandbox.io/s/wizardly-dust-6keed

Dependencies

Usage

yarn add element-or-link

import { ElementOrLink } from 'element-or-link';

const App = () => {
  return (
    <ElementOrLink to="/my-route">
      The element will be a link, not a div.
    <ElementOrLink>
  )
};

Props

{
  to: string,
  children: node,
  element?: string || node, // default is `span`
  displayElement?: boolean, // default is false
}

Example on Codesandbox

https://codesandbox.io/s/wizardly-dust-6keed

🙋‍♂️ Contact me on Twitter

Publish

yarn publish

1.0.0

4 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago