Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Component properties passProps does not pass functions #79

@ghost

Description

Wanted to move the state of the tabs example from the Wiki up into the App.js and it does not seem to pass functions in passProps.

App.js

  constructor(props) {
    super(props);
    this.handleTabChange = this.handleTabChange.bind(this)
    this.state = { selectedTab: 'home' }
  }

componentDidMount() {
  const selectedTab = this.state.selectedTab
  Turbolinks.startSingleScreenApp({ 
    component: 'TabbedView',
    hidesNavBar: true,
    passProps: {
       selectedTab: selectedTab,
       onTabChange: this.handleTabChange
     } 
   })
}

  handleTabChange = (tab) => {
    this.setState({ selectedTab: tab });
  }

When checking the react debugger output onTabChange is never there.

Running "TabbedView" with {"rootTag":181,"initialProps":{"selectedTab":"home"}}

TabbedView.js

  handleChange = (tab) => {
    this.props.onTabChange(tab)
  }

The above fails with

Screen Shot 2020-12-20 at 8 41 09 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions