score:1

Accepted answer

You define contentTypes as class property.
It's actually same as:

class App extends Component {
  constructor() {
    this.contentTypes = {
      A: <A />,
      B: <B />,
      C: <C
           onchange={this.searchHandler.bind(this)}
           content={this.state.searchContent}/>
    }
  }
}

So the element rendered in the constructor and never get any update of props.
Here is a way to fix this:

class App extends Component {
  contentTypes = {
    A: () => (<A/>),
    B: () => (<B/>),
    C: () => (
        <C
          onchange={this.searchHandler.bind(this)}
          content={this.state.searchContent} />
       )
  }

  // ...

  render () {
    const Content = this.contentTypes[this.state.contentType]

    return (
      <div>
      {/* ... */}
        <Content />
      </div>
    )
  }
}

Related Query

More Query from same tag