š¶ SVG and DOM Events: Rx+JSX experiment updates
Kostia Palchyk
Posted on December 20, 2019
With 0.0.8
update Recks receives SVG support š¼
function App() {
return <svg width="300" height="200" stroke="#16b3ff" fill="white">{
range(0, 200, animationFrameScheduler).pipe(
map(r => <circle cx="150" cy="100" r={r / 4} />),
repeat()
)
}</svg>
}
Run this example:
Also event Subjects
Note that 0.0.7
update lets us pass Observers as event handlers š„:
function App() {
const clicks$ = new Subject();
const count$ = clicks$.pipe(
startWith(0),
scan(acc => ++acc)
);
return <button onClick={clicks$}>Clicked {count$} times</button>
}
Run this example:
Try it!
To try Recks locally, run:
git clone https://github.com/recksjs/recks-starter-project.git
cd recks-starter-project
npm i
npm start
Have fun!
āļø If you want to be the first to hear about project updates ā be sure to follow me here, on twitter, or watch the project directly @ github!
The End š
header photo by Patrick Hendry on Unsplash
š šŖ š
š©
Kostia Palchyk
Posted on December 20, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.