Custom FaunaDB hooks for new project
I've got a new project on my mind. It's going to be a mobile app created with Expo and FaunaDB. I know that Fauna can handle user authentication, im currently unsure if I will use that or not as I might want to implement social logins such as Facebook, Google and Twitter. I've used Firebase for this purpose before so am thinking I could match up the two with Fauna handling all the data requirements of the app and Firebase handling the user logins. That being said, the users data will be stored in Fauna so I might have to store it twice. This part will need some more consideration.
I have 3 children and those that have children know that as soon as you buy some piece of clothing for them they seem to instantly grow out of it, thus you are left with basically new or totally destroyed clothing. The same can be said of many toys. In fact, basically anything my children own, they seem to have for a short period of time giving to outgrowing, un-interest or destruction. 😆
Where I live there are a few Facebook groups that parents can post unused or secondhand items for sale, and this is great! But there are certain things that you can't do in a Facebook group that sells stuff, its quite ridged. Making an app for the same purpose, I could add all the missing features. Also, all the users information would 100% not be shared with anyone, unlike what some big social media companies have been known to do. 😜
This is still very early doors but like every good programmer, I started coding before I started planning. I decided to play around with fetching data from Fauna by making some simple React hooks. Right now I only have two and im sure they could be improved upon. This gist is this:
The Fauna Query Language (FQL) seems so expansive, im really looking forward to diving into it deeper into it and creating the mutation hooks. Its nice practice not only of creating custom hooks, but also learning FQL. Not only that, I like the abstraction, all that logic in one place then just import the hooks and get the data!
It wouldn't be any fun if I didn't share how it was going would it? 😄
Fauna Context provider
Then to wrap the root element of any app:
Obviously there is work to be done but its a start! Now, back to planning! 💃🕺