An open API service indexing awesome lists of open source software.

https://github.com/jadbox/rxhooks_examples

React Hook support for Observable Streams
https://github.com/jadbox/rxhooks_examples

Last synced: 17 days ago
JSON representation

React Hook support for Observable Streams

Awesome Lists containing this project

README

          

# PROJECT MOVED

Project moved to https://github.com/jadbox/rxhooks

### Just Show Me the Code

```javascript
function ExampleUseRxState() {
const initialVal = 1;
const [count, signalCount] = useRxState(initialVal,
scan( (acc, x) => x+acc, 0)
);

const onClick = () => {
signalCount(1);
}

return <>
Add 1

count {count}


>
}

function ExampleUseRx() {
const stream = (x) => interval(1000 * x);

const [speed, setSpeed] = useState(1);
const [count] = useRx( stream, speed );

return <>
setSpeed(speed+1)}>Make slower via initialValue change

speed {speed}{' '}|{' '}count {count}


>
}

class App extends Component {

render() {
return (









);
}
}

export default App;
```