Skip to content

Commit 1d5a628

Browse files
committed
feat: user renderProp in SyncSensor
1 parent 8a969dd commit 1d5a628

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "libreact",
3-
"version": "0.2.0",
3+
"version": "0.0.0-development",
44
"description": "React standard library",
55
"main": "lib/index.js",
66
"keywords": [

src/SyncSensor/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Component, createElement as h} from 'react';
22
import {isClient} from '../util';
3+
import renderProp from '../util/renderProp';
34
import * as throttle from 'throttle-debounce/throttle';
45

56
export interface ISyncSensorProps<TState> {
@@ -41,6 +42,6 @@ export class SyncSensor<TState> extends Component<ISyncSensorProps<TState>, TSta
4142
}
4243

4344
render () {
44-
return this.props.children(this.state);
45+
return renderProp(this.props, this.state);
4546
}
4647
}

src/util.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export const sym = (name) => {
3636
return hasSymbols ? Symbol(name) : ns(name);
3737
};
3838

39+
export const isFn = (fn) => typeof fn === 'function';
40+
3941
export {
4042
h
4143
};

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"jsxFactory": "h",
1313
"skipDefaultLibCheck": true,
1414
"skipLibCheck": true,
15+
"experimentalDecorators": true,
1516
"lib": [
1617
"dom",
1718
"es5",

0 commit comments

Comments
 (0)