Add Wordcloud Component #27
|
@ -99,6 +99,7 @@ export const WordCloud = withTooltip(
|
|||
}
|
||||
);
|
||||
|
||||
/** The internal wordcloud component that actually lays out the word needs to be seperate from the tooltip to prevent extra rerendering. */
|
||||
type WordCloudWordsProps = WordCloudProps & {
|
||||
a258wang marked this conversation as resolved
|
||||
data: Array<WordData>;
|
||||
width: number;
|
||||
|
@ -118,7 +119,6 @@ type WordCloudWordsProps = WordCloudProps & {
|
|||
// but they are not needed to render the component
|
||||
snedadah marked this conversation as resolved
a258wang
commented
I'm a little confused what this comment means, but if I'm understanding it correctly then would it be more succinct to say "These props are used for memoization"? Also I would recommend explicitly listing which props instead of saying "These next props" -- this makes the comment a bit more future-proof in case someone decides to change the order of the props or add new props or something in the future. I'm a little confused what this comment means, but if I'm understanding it correctly then would it be more succinct to say "These props are used for memoization"?
Also I would recommend explicitly listing which props instead of saying "These next props" -- this makes the comment a bit more future-proof in case someone decides to change the order of the props or add new props or something in the future.
snedadah
commented
Good point. Good point.
|
||||
tooltipLeft?: number;
|
||||
tooltipTop?: number;
|
||||
// className?: string;
|
||||
};
|
||||
const WordCloudWords: React.FC<WordCloudWordsProps> = ({
|
||||
width,
|
||||
|
|
Loading…
Reference in New Issue
It looks like we're copying a lot of the keys from
WordCloudProps
here, would it be cleaner if we usedOmit<WordCloudProps, ...> & { ... }
instead of copying so much?Omit: https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys
Intersection types (&): https://www.typescriptlang.org/docs/handbook/2/objects.html#intersection-types
Good point on using Omit. I originally did not want to use the same thing since that requires me to move the default parameters inside this component. However, I think it is better this way.