Type ‘{}’ is not assignable to type ‘IntrinsicAttributes & IntrinsicClassAttributes

I solved a lot of “not assignable to type ‘IntrinsicAttributes & IntrinsicClassAttributes” type of errors (Microsoft closed issue) just by declaring an object that is passed entirely to the component.

With the OP’s example, instead of using term={this.props.term}, use {...searchBarProps} to get it working:

render() {
  const searchBarProps = { // make sure all required component's inputs/Props keys&types match
    term: this.props.term
  }
  return (
    <div className="App">
      ...
      <div>
          <form>
          <SearchBar {...searchBarProps} />
          </form>
      </div>
    </div>
  );
}

Leave a Comment