title: Create a toggle button with RxJS
body: <p>I'm pretty new to the concept of Reactive Programming, and I'm just playing around a bit. To practice what I've learned I decided to write some code using RxJS in a real-world project and things are going great. </p>
  
  <p>Now I want to create a simple toggle button: </p>
  
  <pre><code>let btn = $('button')[0]
  let clicks = Rx.Observable.fromEvent(btn, 'click')
                 .map(function(clickEvent) {
                    // decide to return true/false
                 })
  
  clicks.subscribe(value =&gt; {
      // value is true or false
  })
  </code></pre>
  
  <p>I can't get my head around this very simple exercise without using DOM methods in my stream. In fact, I just need the latest value from the stream, and then invert it (!!value);</p>
  
  <p>How can I implement this?</p>