// @flow
import * as React from 'react'
import { connect } from 'react-redux'
import { Redirect } from 'react-router-dom'
import { USER_LOGGED_OUT } from 'frontend/actions/types'
import performLogout from 'frontend/firebase/logout'

type Props = {
  logout: Function
}
class Logout extends React.Component<Props> {
  componentDidMount() {
    performLogout()
    this.props.logout()
  }

  render() {
    return <Redirect to="/" />
  }
}

const mapDispatchToProps = (dispatch: Function) => ({
  logout: () => dispatch({ type: USER_LOGGED_OUT })
})

export default connect(null, mapDispatchToProps)(Logout)

// @flow
import * as React from 'react'
import { Redirect } from 'react-router-dom'
import performLogout from 'frontend/firebase/logout'

class Logout extends React.Component<*> {
  componentDidMount() {
    performLogout()
  }

  render() {
    return <Redirect to="/" />
  }
}

export default Logout

--- 
+++ 
@@ -1,11 +1,17 @@
 // @flow
 import * as React from 'react'
+import { connect } from 'react-redux'
 import { Redirect } from 'react-router-dom'
+import { USER_LOGGED_OUT } from 'frontend/actions/types'
 import performLogout from 'frontend/firebase/logout'
 
-class Logout extends React.Component<*> {
+type Props = {
+  logout: Function
+}
+class Logout extends React.Component<Props> {
   componentDidMount() {
     performLogout()
+    this.props.logout()
   }
 
   render() {
@@ -13,4 +19,8 @@
   }
 }
 
-export default Logout
+const mapDispatchToProps = (dispatch: Function) => ({
+  logout: () => dispatch({ type: USER_LOGGED_OUT })
+})
+
+export default connect(null, mapDispatchToProps)(Logout)
Clear user login state in Redux on logout.
