# element-or-link

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

Latest version **1.0.0** (published 2019-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install element-or-link
pnpm add element-or-link
yarn add element-or-link
bun add element-or-link
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-11-12 |
| First published | 2019-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Johannes Bräunig |
| Maintainers | johannes.braeunig |
| Keywords | react, react-router, hyperlink or any element |

## Links

- npm: https://www.npmjs.com/package/element-or-link
- Repository: git@github.com:johannesbraeunig/element-or-link
- Homepage: https://github.com/johannesbraeunig/element-or-link
- npm.io page: https://npm.io/package/element-or-link

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-11-12
- 0.4.0 — 2019-10-22
- 0.3.0 — 2019-10-21
- 0.2.1 — 2019-10-21
- 0.2.0 — 2019-10-21
- 0.1.0 — 2019-10-21

## README

# 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

- [react-router-dom](https://reacttraining.com/react-router/web/guides/quick-start)

## Usage

`yarn add element-or-link`

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

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

## Props

```js
{
  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](https://codesandbox.io/s/wizardly-dust-6keed)

### 🙋‍♂️ Contact me on [Twitter](https://twitter.com/joschie)

## Publish

`yarn publish`

---
_Source: https://npm.io/package/element-or-link · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
