import React , { useEffect } from 'react' ; import { useDispatch } from 'react-redux' ; import PropTypes from 'prop-types' ; import { useStaticQuery , graphql } from 'gatsby' ; import Header from './header' ; import './layout.css' ; import { todosRequested } from '../state/actions/todos' ; const Layout = ( { children } ) => { const dispatch = useDispatch ( ) ; useEffect ( ( ) => { dispatch ( todosRequested ( ) ) ; } , [ ] ) ; const data = useStaticQuery ( graphql `
    query SiteTitleQuery {
      site {
        siteMetadata {
          title
        }
      }
    }
  ` ) ; return ( < > < Header siteTitle = { data . site . siteMetadata . title } / > < div style = { { margin : '0 auto' , maxWidth : 960 , padding : '0px 1.0875rem 1.45rem' , paddingTop : 0 , } } > < main > { children } < /main> < footer > © { new Date ( ) . getFullYear ( ) } , Built with { ' ' } < a href = 'https://www.gatsbyjs.org' > Gatsby < /a> { ' ' } by { ' ' } < a href = 'https://www.evaluates2.com' > Evaluates2 < /a> . < /footer> < /div> < />); } ; Layout . propTypes = { children : PropTypes . node . isRequired , } ; export default Layout ;