React, Redux & Firebase App Tutorial #17 - Connecting Redux to Firebase
Skills:
React90%
Key Takeaways
Connects Redux to Firebase using third-party packages to interact with Firestore database in a React application
Full Transcript
all right then gangs so then so far we have created our Firebase project and we've also created a fire store right here added a project collection and a document to that project collection we've also in our react app over here created a config file for our Firebase setup and we've exported that Firebase object at the bottom in case we need this somewhere else inside the application so now what we want to do is somehow find out a way to add a new project to our fir store database from our application when we submit the form on the website now we already have a create project action over here and this is where we can make some kind of asynchronous call to do that we just need to finish this up so we want to interact with the fire store here to add a new project so how do we do that exactly well we could use the normal Firebase Library we've just installed to do that that's absolutely fine but instead what I'd like to do is install a couple of packages specifically designed for Redux and Firebase to work together in Synergy and these packages are called react Redux Firebase and Redux fir store now react Redux Firebase that provides bindings to the Firebase Service as a whole and Redux fir store provides Redux bindings for fir store databases in particular in short installing these two packages means that we'll be able to use the Firebase API to interact with our database inside these action creators and it also means that we'll be able to sync up our firestore database with our react store so let's install these packages first of all open up your terminal then npm install and first of all react Redux Firebase oops spell this correctly and then Redux hyphen fir store okay so install both of those and once those are installed we can now use them inside our project so just like we added thk functionality to our store we have to do something similar with these packages so what I'm going to do is open up index.js where we create our store right here and I'm going to import something from each one of these packages so first of all I'm going to import get fir store and this will be from Redux hyphen fir store then I'm going to import get Firebase from react Redux Firebase Okay so we've imported both of these things right here and what we want to do is use them so that we can access the Firebase or fire store API inside this function right here and the way we can do that is by tacking them on to this thing right here so what we can do is actually use a function on this thunk called with extra arguments and this extra argument is going to be an object and inside this object we can pass in different properties now the properties I want to pass in are these two things right here get fire store and get Firebase so let's add both of those in so I'll say get Firebase first of all and then get fir store so now what will happen is inside this thing over here this function because thk allows us to return a function we get an extra argument that's what this thing does over here with extra argument okay it allows us to pass in an extra argument over here which is an object now I want to destructure two properties from that object that we applied over here we applied these two properties to that object get Firebase and get fire store which are going to equal these things over here so what we can do is just destructure those inside curly braces so I could say get Firebase and get fire store and then we can use these two objects right here to interact with our Firebase and fire store but but if we did that at the minute then this is not going to work because these two things don't actually know about our project they don't know the details of it yeah we created in the Firebase config over here all of this setup and we connected to the Firebase project but at the minute we're not doing anything else with it we're not passing that information on to Redux or these things over here so they don't really know about our project so somehow we have to tell these two things these two packages over here Redux fire store and react Redux Firebase we have to tell those things that this is our Firebase config I want you to connect to this Firebase project for us now the way we do that is by using some store enhancers inside this now we've talked a little bit about store enhancers this thing right here this thk is a middleware and when we apply middleware over here like this this returns a store enhancer so we can add multiple store enhancers to a store and the way we do that is by using compose so much like inside our reducers when we have a root reducer which combines several reducers together we can do a similar thing over in the store we can combine several store enhancers together and we do that using a method called compose so first of all let's import compose and we do that from the Redux Library so compose over there then what I'd like to do is before apply middleware I'm just going to say compose and this is a function now let's get rid of the second bracket because this apply middleware this first thing right here this is going to be the first door enhancer that we're composing together with other things so let us now close this off like so that's the composed thing over there then we're closing off create store so that's the first store enhancer right there we want to ose two more so I'd like to now import Redux fir store from Redux fire store and also react Redux Firebase from react Redux Firebase and these are the other two store enhancers so let's add them into the compos method so first of all this thing Redux fire store like so which is a function and then also this thing react Redux Firebase let's copy that and add that in too okay so we're adding in these store enhancers and that's enhancing our store with these packages right so that we can link the two together but we need to pass in our config for our F base in here so that when we're enhancing our store we're passing in that config and therefore when we use these things over here then these things know which project to connect to make sense so let's do that we need to import our config over here from this file so we'll say import FB config from and it's slash then into the config folder then FB config like so so now we can take this configuration and we can pass it into both of these like this all right then so now when we try to use the because we've passed that configuration into these store enhancers right here then these things know what to connect to and since these things now know what to connect to we can go ahead and use this thing get fir store in the next video to connect to our fire store and add a document to our collection
Original Description
Hey gang, in this React, Redux & Firebase tutorial we'll use a couple of third-party packages to connect to Firebase and Firestore from Redux.
----------------------------------------
🐱💻 🐱💻 Course Links:
+ VS Code editor - https://code.visualstudio.com/
+ GitHub repository (course files) - https://github.com/iamshaunjp/React-Redux-Firebase-App
🧠🧠 Other Helpful Playlists:
+ React & Redux Tutorial - https://www.youtube.com/playlist?list=PL4cUxeGkcC9ij8CfkAY2RAGb-tmkNwQHG
+ JavaScript for Beginners - https://www.youtube.com/playlist?list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET
🤑🤑 Donate
+ https://www.paypal.me/thenetninja
🎓🎓 Find me on Udemy
+ https://www.udemy.com/user/47fd83f6-5e4a-4e87-a0f0-519ac51f91b6/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Net Ninja · Net Ninja · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
GraphQL Tutorial #5 - Express App Setup
Net Ninja
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
GraphQL Tutorial #8 - Root Query
Net Ninja
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
GraphQL Tutorial #12 - Author Type
Net Ninja
GraphQL Tutorial #13 - Type Relations
Net Ninja
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
GraphQL Tutorial #18 - Mutations
Net Ninja
GraphQL Tutorial #19 - More on Mutations
Net Ninja
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
GraphQL Tutorial #23 - Create React App
Net Ninja
GraphQL Tutorial #24 - Book List Component
Net Ninja
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
GraphQL Tutorial #28 - Add Book Component
Net Ninja
GraphQL Tutorial #29 - External Query File
Net Ninja
GraphQL Tutorial #30 - Updating Component State
Net Ninja
GraphQL Tutorial #31 - Composing Queries
Net Ninja
GraphQL Tutorial #32 - query variables
Net Ninja
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
GraphQL Tutorial #34 - Book Details Component
Net Ninja
GraphQL Tutorial #36 - Styling the App
Net Ninja
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
Updated Vue & Firebase Course (Udemy)
Net Ninja
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja
More on: React
View skill →Related Reads
📰
📰
📰
📰
How I Added Browser-Based HEIC to JPG Conversion (No Server, No Upload)
Dev.to · Rushikesh Lade
Angular Signals in 2026: From Fundamentals to Architect-Level Patterns
Dev.to · Amanulla Khan
How to embed a widget on any site without CSS collisions (Shadow DOM)
Dev.to · Michael Yousrie
Building a Simple Calculator with HTML, CSS, and JavaScript
Medium · JavaScript
🎓
Tutor Explanation
DeepCamp AI