Skip to content

Commit db3dfd2

Browse files
authored
feat(component): API improvements
BREAKING CHANGE: Breaking changes in the API.
1 parent f9c8242 commit db3dfd2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as React from "react";
33
export interface ProgressiveImageProps {
44
preview: string;
55
src: string;
6+
render: (src: string, style: {}) => JSX.Element;
67
transitionTime?: number;
78
timingFunction?: string;
89
initialBlur?: number;
@@ -33,11 +34,8 @@ export class ProgressiveImage extends React.Component<ProgressiveImageProps, Pro
3334

3435
render() {
3536
const {src} = this.state;
36-
const {children} = this.props;
37-
if (!children || typeof children !== "function") {
38-
throw new Error("ProgressiveImage requires a function as its only child");
39-
}
40-
return children(src, this.getStyle());
37+
const {render} = this.props;
38+
return render(src, this.getStyle());
4139
}
4240

4341
private fetch(src: string): Promise<string> {

0 commit comments

Comments
 (0)