re-rxjs / react-rxjs

React bindings for RxJS
https://react-rxjs.org
MIT License
555 stars 20 forks source link

[BUG] bind is returning an array when an Object is passed through the observer. #293

Closed Jimmy89 closed 1 year ago

Jimmy89 commented 1 year ago

If an object is send through an observer, and the observer is binded, the hook of the bind within React returns an array (as in Object.entries(obj)).

Expected: the actual object.

Example:

const [useObj] = bind(observer$.pipe(
    tap(console.log) // <-- returns an object as expected. e.g. { key: "value"} 
), {});

export default function useDependency(dependency) {
    const obj = Obj(); // <--- returns an array as if Object.entries(obj) has been executed. Expecting an object, but returns: [key, value].
Jimmy89 commented 1 year ago

Sorry for creating a ticket, it seems this was my own fault, no bug.