Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react'
- const withAuth = (EnhancedComponent) => {
- return class extends Component {
- constructor(props) {
- super(props)
- this.state = {
- authenticated: false
- }
- }
- componentDidMount() {
- console.log('console logging from withAuth')
- }
- render() {
- return (
- <EnhancedComponent
- loggedIn]{this.state.loggedIn}
- {...this.props}
- />)
- }
- }
- }
- export default withAuth
- // to use this, we need to setup a new action in our auth_controller (with action auth#check)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement