This is a really entry-level reactive programming question. The following code will log an array of users from github. How can I get access to loging each individual user.login using Rx?
import axios from 'axios'
import Rx from 'rx'
let requestStream = Rx.Observable.just('https://api.github.com/users')
let getJSON = (url) => {
return axios.get(url).then(response => response.data)
}
let responseStream = requestStream
.flatMap(function(requestUrl) {
return Rx.Observable.fromPromise(getJSON(requestUrl))
})
responseStream.subscribe(function(response) {
console.log(response)
})
I've tried:
let responseStream = requestStream
.flatMap(function(requestUrl) {
return Rx.Observable.fromPromise(getJSON(requestUrl))
})
.flatMap(user => {
console.log(user)
})
and:
let users = responseStream
.flatMap(user => {
console.log(user)
})
users.subscribe(function(response) {
// console.log(response)
})