# Build a React Application using RxJS

**URL:** <https://community.auth0.com/t/build-a-react-application-using-rxjs/24918>\
**Category:** Blog Discussions\
**Tags:** rxjs, react\
**Created:** [May 7, 2019, 4:03pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918 "2019-05-07T16:03:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramiro](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ramiro/32/8077_2.png) [@ramiro](https://community.auth0.com/u/ramiro)\
**Post date:** [May 7, 2019, 4:03pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/1 "2019-05-07T16:03:43Z")

</div>

Learn how to build and authenticate a React application using Auth0 and RxJS. Front-end styled with the CSS framework, Tailwind.

Read on ⚛\>\> [The Complete Guide to React User Authentication | Auth0](https://auth0.com/blog/build-a-react-application-using-rxjs)

Brought to you by @kapehe 👩🏻‍💻

 ![](https://global.discourse-cdn.com/auth0/original/3X/2/0/20ef4b2f55ba542daf5d38418ec17cf69f52ec4f.png)

---

<div class="post-metadata">

**Author:** ![kapehe](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kapehe/32/21053_2.png) [@kapehe](https://community.auth0.com/u/kapehe)\
**Post date:** [May 7, 2019, 8:12pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/2 "2019-05-07T20:12:38Z")

</div>

Thanks for reading!

Is this your first time building with React + RxJS? Tell me how it went for you!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [September 3, 2019, 6:58am UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/3 "2019-09-03T06:58:37Z")

</div>



---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [September 7, 2019, 3:58pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/4 "2019-09-07T15:58:22Z")

</div>



---

<div class="post-metadata">

**Author:** ![ddoronin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ddoronin/32/19146_2.png) [@ddoronin](https://community.auth0.com/u/ddoronin)\
**Post date:** [February 13, 2020, 4:34am UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/5 "2020-02-13T04:34:47Z")

</div>

This is really impressive! I love how RxJS helps to model data flows. Your example is a perfect demonstration of it.  
One nifty thing for your code, if you replace a flatMap with a switchMap, you’ll get a concurrent http calls cancellation 😉  
BTW I totally understand why you injected observable values into a component state (there is no other way). To make it more seamless I’ve made, open-sourced and published a library called @reonomy/reactive-hooks

This library exposes a set of React hooks for RxJS such as useRxState() that helps to work with observables directly. For example:

```auto
const input$ = new BehaviorSubject("");
const user$ = input$.pipe(
                debounceTime(3000),
                filter(value => value.length > 3),
                flatMap(...)
            );

function Protected() {
    const [input, setInput] = useRxState(user$);
    const [user] = useRxState(user$);

    return (
            <div>
                {user && (
                    <div className="mb-4">
                        <img src={user.avatar_url} alt="GitHub Avatar" width="200" className="shadow rounded mb-2" />
                        <h3 className="text-2xl text-blue-darker">{user.login}</h3>
                    </div>
                )}
                <input onChange={e => setInput(e.target.value)} placeholder="GitHub Username Here" className="py-3 px-4 rounded shadow w-64" />
                <button onClick={() => Auth0.signOut()} className="mx-auto mt-5 p-2 text-xs block rounded bg-blue-lightest text-blue-darker hover:bg-blue-lightest">
                    Log Out
                </button>
            </div>
        );
}

```

Happy to share more details 🙂  
Regards,  
[Dmitry](https://www.linkedin.com/in/ddoronin)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 13, 2020, 9:37am UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/6 "2020-02-13T09:37:10Z")

</div>

That’s a great job @ddoronin!

Is the repo something you can share publicly? If so make sure to create another topic under `Show Your Auth0` category. Thanks!

---

<div class="post-metadata">

**Author:** ![ddoronin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ddoronin/32/19146_2.png) [@ddoronin](https://community.auth0.com/u/ddoronin)\
**Post date:** [February 13, 2020, 3:45pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/7 "2020-02-13T15:45:48Z")

</div>

Yeah, the repo is public:

> **[GitHub - reonomy/reactive-hooks: Reactive Hooks Library](https://github.com/reonomy/reactive-hooks)**
>
> Reactive Hooks Library. Contribute to reonomy/reactive-hooks development by creating an account on GitHub.

ohhh… you know what, it would be cool to make React hooks for Auth0 if it’s not done yet 🙂

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [February 13, 2020, 3:56pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/8 "2020-02-13T15:56:51Z")

</div>

Thanks a lot for sharing that @ddoronin!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 10, 2021, 8:49am UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/9 "2021-12-10T08:49:28Z")

</div>



---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 7, 2022, 1:56pm UTC](https://community.auth0.com/t/build-a-react-application-using-rxjs/24918/10 "2022-03-07T13:56:57Z")

</div>


