1.0.7 • Published 4 years ago

react-as-component v1.0.7

Weekly downloads
19
License
ISC
Repository
-
Last release
4 years ago

How to install

npm i react-as-component

How to use

import AsComponent from 'react-as-component';

function MyDivFromAsComponent (){
  return <AsComponent as={"div"}>...</AsComponent>;
}

Examples

Example button, which can be link

import AsComponent from 'react-as-component';

function MyButton({ asLink = false,  value = "" }) {
  return <AsComponent as={asLink ? 'a' : 'button'}>{value}</AsComponent>;
}

or Link from react-router-dom

import { Link } from 'react-router-dom';
import AsComponent from 'react-as-component';

function MyButton({ asLink = false, value = "" }) {
  return <AsComponent as={asLink ? Link : 'button'}>{value}</AsComponent>;
}
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago