Skip to content

Typing of Prop in Custom Hit Component #5970

Answered by dhayab
theovier asked this question in Q&A
Discussion options

You must be logged in to vote

Here's an example of how it could be typed:

import type { Hit } from 'instantsearch.js';

type HitProps = {
  hit: Hit<{
    name: string;
  }>;
};

const Hit: React.FC<HitProps> = ({ hit }) => {
  return <div>{hit.name}</div>;
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@theovier
Comment options

Answer selected by theovier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants