Skip to content

Commit ea5d086

Browse files
author
James Fox
authored
make OptimizelyVariation a functional component (#38)
1 parent 9ee3cf3 commit ea5d086

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Variation.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
import * as React from 'react';
1717

1818
export type VariationProps = {
19-
variation?: any;
19+
variation?: string;
2020
default?: any;
2121
children?: React.ReactNode;
2222
};
2323

24-
class Variation extends React.Component<VariationProps, {}> {
25-
render() {
26-
return this.props.children;
27-
}
28-
}
24+
// Wrap the return value here in a Fragment to please the HOC's expected React.ComponentType
25+
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051
26+
const Variation: React.FunctionComponent<VariationProps> = ({ children }) => <>{children}</>;
2927

3028
export const OptimizelyVariation = Variation;

0 commit comments

Comments
 (0)