Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

390
Views
I'm getting an Uncaught TypeError: Cannot read properties of undefined (reading HostWorkflow)

I have a react component shown below and I'm trying to conditionally render some components. The goal is that when the current session is a host, the function AppropriatePage should return the HostWorkflow component, however I run into the Uncaught TypeError.

I referred to this to do this.

export default class HostPage extends Component {
    constructor(props) {
        super(props);
        
        this.state = {
            participants: 0,
            questions: 0,
            host: true,
            session_id: -1,
        };
        this.session_code = this.props.match.params.session_code;
    }   
HostWorkflow() {
        return (<Grid container spacing={1}>
            <Grid item xs={12} align="left">
                <Button color='secondary' onClick={this.handleEndSession}>End Session</Button>
            </Grid>
            <Grid item xs={4} align="left">
                <p>SESSION {this.session_code}</p>
            </Grid>
            <Grid item xs={4} align="center">
                <p>PARTICIPANTS {this.state.participants}</p>
            </Grid>
            <Grid item xs={4} align="right">
                <p>QUESTIONS {this.state.questions}</p>
            </Grid>
        </Grid>);
    }

    AppropriatePage(props) {
        const is_host = props.host;
        if (is_host) {
            console.log("TEST MY IF");
            return (<this.HostWorkflow />);
        }
        return <p>NOT HOST</p>;
    }
    render() {
        return (<this.AppropriatePage host={this.state.host} />);
    }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!