Last active
August 12, 2018 08:49
-
-
Save Manoz/3c95e1b7076bb9a36f85dbdb981e39e0 to your computer and use it in GitHub Desktop.
React reusable component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
class MyComponent extends React.Component { | |
render() { | |
const MyLink = props => <a href={props.theurl} target="_blank" > {props.thename}</a>; | |
return ( | |
<div> | |
<nav> | |
<MyLink theurl="http://www.example.com/page1" thename="My link" /> | |
<MyLink theurl="http://www.example.com/page2" thename="Another link" /> | |
<MyLink theurl="http://www.example.com/page3" thename="A better link" /> | |
<MyLink theurl="http://www.example.com/page4" thename="A bad link" /> | |
</nav> | |
</div> | |
); | |
} | |
} | |
export default MyComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment