In this blog post, We’ll learn, how to use push method to add a value to realtime database in Firebase. This is an example written in react/react-native application
In this Example, we will be using
react
or react-native
application.Add the following code to push an item Buy Groceries
and the status of the item(completed/not completed) as false
database.ref('/todoitems').push({
done: false,
todoItemName: "Buy Groceries"
});
When you add item, then your JSON in Firebase DB should look like this
In the next post, we will discuss on updating the data, setting done
item to true
.