react-with-observable
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -20,3 +20,3 @@ import 'symbol-observable'; | ||
}; | ||
export declare class Subscribe<T = any> extends React.Component<SubscribeProps<T>> { | ||
export declare class Subscribe<T extends React.ReactNode> extends React.PureComponent<SubscribeProps<T>> { | ||
private SubscriptionComponent; | ||
@@ -23,0 +23,0 @@ render(): JSX.Element; |
@@ -106,3 +106,3 @@ (function (global, factory) { | ||
return Subscribe; | ||
}(React.Component)); | ||
}(React.PureComponent)); | ||
@@ -109,0 +109,0 @@ exports.Subscribe = Subscribe; |
{ | ||
"name": "react-with-observable", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -18,3 +18,5 @@ "main": "build/index.js", | ||
"build": "rimraf build && rollup -c", | ||
"test": "jest --detectLeaks", | ||
"test": "npm-run-all -p test:jest test:types", | ||
"test:jest": "jest --detectLeaks", | ||
"test:types": "tslint -c ./tslint.json --project ./tsconfig.json", | ||
"test:coverage": "jest --detectLeaks --coverage", | ||
@@ -49,12 +51,14 @@ "test:coveralls": "npm run test:coverage && cat coverage/lcov.info | coveralls ", | ||
"symbol-observable": "1.2.0", | ||
"ts-jest": "22.4.6", | ||
"ts-jest": "23.0.0", | ||
"ts-node": "7.0.0", | ||
"tslint": "5.10.0", | ||
"typescript": "2.9.2", | ||
"typestrict": "0.0.9", | ||
"weak": "1.0.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=0.16.0 <17.0.0", | ||
"react-dom": ">=0.16.0 <17.0.0", | ||
"create-subscription": ">=0.16.0 <17.0.0" | ||
"react": ">=16.3.0 <17.0.0", | ||
"react-dom": ">=16.3.0 <17.0.0", | ||
"create-subscription": ">=16.3.0 <17.0.0" | ||
} | ||
} |
@@ -8,11 +8,11 @@ # react-with-observable | ||
`react-with-observable` is a component which allows you to use Observables declaratively. | ||
`react-with-observable`: use Observables declaratively in ️️React! | ||
* ✅ Supports any Observable implementation compatible with ECMAScript Observable (eg. **RxJS**)! | ||
* ✅ Inspired by `AsyncPipe` from Angular! | ||
* ✅ Very extensible simply by composing Observable operators! | ||
* ✅ Inspired by the `AsyncPipe` from Angular! | ||
* ✅ Very extensible by composing Observable operators! | ||
It handles subscribing and unsubscribing automatically, and, hence, you don't have to worry about memory leaks or updating state when new values come! | ||
It handles subscribing and unsubscribing automatically and, hence, you don't have to worry about memory leaks or updating state when new values come! | ||
Inspired by the `AsyncPipe` from Angular. Uses [`create-subscription`](https://github.com/facebook/react/tree/master/packages/create-subscription) under the hood. | ||
Inspired by the `AsyncPipe` from Angular. Uses React's [`create-subscription`](https://github.com/facebook/react/tree/master/packages/create-subscription) under the hood. | ||
@@ -28,3 +28,3 @@ ## Install | ||
### Basics | ||
This package exports a single named component `Subscribe`. It expects you to provide a an Observable as its only child: | ||
This package exports a single named component `Subscribe`. It expects you to provide an Observable as its only child: | ||
@@ -36,2 +36,3 @@ ```javascript | ||
``` | ||
This results in "Hello, world!" being displayed. | ||
@@ -52,3 +53,3 @@ | ||
### Operators | ||
You can transform the Observable as you wish, as long as the final result is also an Observable. | ||
You can transform the Observable as you wish, as long as the final result is also an Observable: | ||
@@ -66,6 +67,7 @@ ```javascript | ||
``` | ||
As a result, an `<input>` element is rendered. It's value is changed every second to 0, 10, 30, 60, 100 and so on. | ||
As a result, an `<input>` element is rendered. Its value is changed every second to 0, 10, 30, 60, 100… and so on. | ||
### Initial value | ||
Use your Observable library! The library doesn't provide any custom way to provide the default value and it doesn't need to. For example, with rxjs, you can use the `startWith` operator: | ||
Use your Observable library! `react-with-observable` doesn't implement any custom way to provide the default value and it doesn't need to. For example, with RxJS, you can use the `startWith` operator: | ||
@@ -127,1 +129,5 @@ ```javascript | ||
``` | ||
## Bugs? Feature requests? | ||
Feel free to create a new issue: [issues](https://github.com/mmiszy/react-with-observable/issues). Pull requests are also welcome! | ||
import 'symbol-observable'; | ||
import { configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import * as Adapter from 'enzyme-adapter-react-16'; | ||
configure({ adapter: new Adapter() }); |
14805
14
209
128
27