refactor: using react hooks

This commit is contained in:
alxshelepenok
2019-05-09 16:57:42 +03:00
parent cb4d08f434
commit 4ada925e0f
45 changed files with 1972 additions and 781 deletions

View File

@@ -1,11 +1,11 @@
// @flow
import React from 'react';
import { graphql, StaticQuery } from 'gatsby';
import { getContactHref } from '../../../utils';
import styles from './Author.module.scss';
import { useSiteMetadata } from '../../../hooks';
export const PureAuthor = ({ data }: Object) => {
const { author } = data.site.siteMetadata;
const Author = () => {
const { author } = useSiteMetadata();
return (
<div className={styles['author']}>
@@ -24,25 +24,4 @@ export const PureAuthor = ({ data }: Object) => {
);
};
export const Author = () => (
<StaticQuery
query={graphql`
query AuthorQuery {
site {
siteMetadata {
author {
name
bio
contacts {
twitter
}
}
}
}
}
`}
render={(data) => <PureAuthor data={data} />}
/>
);
export default Author;