Add Link component

This commit is contained in:
Tom Raithel
2017-02-21 21:54:38 +01:00
parent c0dd1809e3
commit f284b4b310
9 changed files with 76 additions and 22 deletions

21
js/components/Link.js Normal file
View File

@@ -0,0 +1,21 @@
import React from 'react';
import { connect } from 'react-redux';
import actions from '../actions';
function Link({ pageName, children, navigate, className}) {
const handleClick = (e) => {
e.preventDefault();
navigate(pageName);
};
return (
<a href={`/${pageName}.html`} onClick={handleClick} {...{ className }}>
{children}
</a>
);
}
export default connect(
undefined,
actions
)(Link);