{"id":79378,"date":"2024-09-30T23:04:05","date_gmt":"2024-09-30T16:04:05","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=79378"},"modified":"2024-09-30T23:04:05","modified_gmt":"2024-09-30T16:04:05","slug":"react-native-firebase-la-gi","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/","title":{"rendered":"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#Ly_do_chon_Firebase_cho_cac_ung_dung_su_dung_React_Native\" >L\u00fd do ch\u1ecdn Firebase cho c\u00e1c \u1ee9ng d\u1ee5ng s\u1eed d\u1ee5ng React Native\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#Cac_buoc_chuan_bi_va_cai_dat_Firebase_trong_React_Native\" >C\u00e1c b\u01b0\u1edbc chu\u1ea9n b\u1ecb v\u00e0 c\u00e0i \u0111\u1eb7t Firebase trong React Native<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#Cac_tinh_nang_Firebase_pho_bien_su_dung_trong_React_Native\" >C\u00e1c t\u00ednh n\u0103ng Firebase ph\u1ed5 bi\u1ebfn s\u1eed d\u1ee5ng trong React Native\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#Huong_dan_toi_uu_hoa_ung_dung_su_dung_React_Native_voi_Firebase\" >H\u01b0\u1edbng d\u1eabn t\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng s\u1eed d\u1ee5ng React Native v\u1edbi Firebase<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#Cac_cau_hoi_thuong_gap_ve_React_Native_Firebase\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 React Native Firebase<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#Tong_ket_React_Native_Firebase\" >T\u1ed5ng k\u1ebft React Native Firebase<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong><em>React Native Firebase l\u00e0 m\u1ed9t gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd cho ph\u00e9p c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n k\u1ebft h\u1ee3p s\u1ee9c m\u1ea1nh c\u1ee7a n\u1ec1n t\u1ea3ng ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng \u0111a n\u1ec1n t\u1ea3ng React Native v\u1edbi c\u00e1c d\u1ecbch v\u1ee5 \u0111a d\u1ea1ng v\u00e0 linh ho\u1ea1t c\u1ee7a Firebase. S\u1ef1 t\u00edch h\u1ee3p n\u00e0y gi\u00fap t\u1ed1i \u01b0u h\u00f3a qu\u00e1 tr\u00ecnh x\u00e2y d\u1ef1ng c\u00e1c \u1ee9ng d\u1ee5ng di \u0111\u1ed9ng hi\u1ec7n \u0111\u1ea1i v\u1edbi c\u00e1c t\u00ednh n\u0103ng nh\u01b0 x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng, l\u01b0u tr\u1eef d\u1eef li\u1ec7u, g\u1eedi th\u00f4ng b\u00e1o \u0111\u1ea9y, v\u00e0 nhi\u1ec1u d\u1ecbch v\u1ee5 kh\u00e1c m\u00e0 Firebase cung c\u1ea5p.<\/em><\/strong><\/p>\n<p><span style=\"font-weight: 400;\">Trong b\u00e0i vi\u1ebft n\u00e0y, ch\u00fang ta s\u1ebd kh\u00e1m ph\u00e1:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">C\u00e1ch React Native Firebase c\u00f3 th\u1ec3 gi\u00fap r\u00fat ng\u1eafn th\u1eddi gian ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng, t\u0103ng c\u01b0\u1eddng hi\u1ec7u su\u1ea5t, v\u00e0 cung c\u1ea5p tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng m\u01b0\u1ee3t m\u00e0<\/span><\/li>\n<li><span style=\"font-weight: 400;\">C\u00e1ch c\u1ea5u h\u00ecnh v\u00e0 s\u1eed d\u1ee5ng c\u00e1c d\u1ecbch v\u1ee5 Firebase th\u00f4ng qua React Native m\u1ed9t c\u00e1ch d\u1ec5 d\u00e0ng v\u00e0 hi\u1ec7u qu\u1ea3<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Ly_do_chon_Firebase_cho_cac_ung_dung_su_dung_React_Native\"><\/span><strong>L\u00fd do ch\u1ecdn Firebase cho c\u00e1c \u1ee9ng d\u1ee5ng s\u1eed d\u1ee5ng React Native\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Firebase l\u00e0 m\u1ed9t trong nh\u1eefng n\u1ec1n t\u1ea3ng \u0111\u00e1m m\u00e2y to\u00e0n di\u1ec7n v\u00e0 m\u1ea1nh m\u1ebd \u0111\u01b0\u1ee3c nhi\u1ec1u nh\u00e0 ph\u00e1t tri\u1ec3n l\u1ef1a ch\u1ecdn khi x\u00e2y d\u1ef1ng \u1ee9ng d\u1ee5ng React Native. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 nh\u1eefng l\u00fd do ch\u00ednh khi\u1ebfn Firebase tr\u1edf th\u00e0nh l\u1ef1a ch\u1ecdn h\u00e0ng \u0111\u1ea7u:<\/span><\/p>\n<p><b> T\u00edch h\u1ee3p d\u1ec5 d\u00e0ng<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Firebase h\u1ed7 tr\u1ee3 t\u00edch h\u1ee3p d\u1ec5 d\u00e0ng v\u00e0o c\u00e1c \u1ee9ng d\u1ee5ng React Native th\u00f4ng qua th\u01b0 vi\u1ec7n <\/span><b>React Native Firebase<\/b><span style=\"font-weight: 400;\">, m\u1ed9t b\u1ed9 SDK ch\u00ednh th\u1ee9c v\u00e0 m\u1ea1nh m\u1ebd. Th\u01b0 vi\u1ec7n n\u00e0y gi\u00fap vi\u1ec7c k\u1ebft n\u1ed1i v\u00e0 s\u1eed d\u1ee5ng c\u00e1c d\u1ecbch v\u1ee5 Firebase trong \u1ee9ng d\u1ee5ng React Native tr\u1edf n\u00ean \u0111\u01a1n gi\u1ea3n h\u01a1n v\u1edbi nhi\u1ec1u t\u00e0i li\u1ec7u chi ti\u1ebft v\u00e0 c\u1ed9ng \u0111\u1ed3ng h\u1ed7 tr\u1ee3 r\u1ed9ng l\u1edbn.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ch\u1ec9 c\u1ea7n v\u00e0i b\u01b0\u1edbc c\u1ea5u h\u00ecnh, b\u1ea1n \u0111\u00e3 c\u00f3 th\u1ec3 b\u1eaft \u0111\u1ea7u s\u1eed d\u1ee5ng c\u00e1c t\u00ednh n\u0103ng c\u1ee7a Firebase m\u00e0 kh\u00f4ng c\u1ea7n ph\u1ea3i x\u00e2y d\u1ef1ng c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng ph\u1ee9c t\u1ea1p.<\/span><\/p>\n<p><b> H\u1ed7 tr\u1ee3 \u0111a n\u1ec1n t\u1ea3ng<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Firebase h\u1ed7 tr\u1ee3 t\u1ed1t cho c\u1ea3 hai h\u1ec7 \u0111i\u1ec1u h\u00e0nh ph\u1ed5 bi\u1ebfn nh\u1ea5t l\u00e0 <\/span><b>iOS<\/b><span style=\"font-weight: 400;\"> v\u00e0 <\/span><b>Android<\/b><span style=\"font-weight: 400;\">. Khi ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng React Native, v\u1ed1n d\u0129 l\u00e0 m\u1ed9t framework \u0111a n\u1ec1n t\u1ea3ng, Firebase tr\u1edf th\u00e0nh m\u1ed9t \u0111\u1ed1i t\u00e1c ho\u00e0n h\u1ea3o khi c\u00f3 th\u1ec3 cung c\u1ea5p c\u00e1c d\u1ecbch v\u1ee5 nh\u1ea5t qu\u00e1n tr\u00ean c\u1ea3 hai n\u1ec1n t\u1ea3ng. \u0110i\u1ec1u n\u00e0y gi\u00fap gi\u1ea3m b\u1edbt s\u1ef1 ph\u1ee9c t\u1ea1p trong vi\u1ec7c duy tr\u00ec v\u00e0 ph\u00e1t tri\u1ec3n c\u00e1c \u1ee9ng d\u1ee5ng di \u0111\u1ed9ng \u0111a n\u1ec1n t\u1ea3ng m\u00e0 v\u1eabn \u0111\u1ea3m b\u1ea3o ch\u1ea5t l\u01b0\u1ee3ng v\u00e0 hi\u1ec7u su\u1ea5t cao.<\/span><\/p>\n<p><b> T\u00ednh n\u0103ng phong ph\u00fa<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Firebase mang \u0111\u1ebfn m\u1ed9t lo\u1ea1t c\u00e1c t\u00ednh n\u0103ng \u0111a d\u1ea1ng v\u00e0 m\u1ea1nh m\u1ebd cho \u1ee9ng d\u1ee5ng React Native, h\u1ed7 tr\u1ee3 to\u00e0n di\u1ec7n t\u1eeb vi\u1ec7c x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng \u0111\u1ebfn qu\u1ea3n l\u00fd d\u1eef li\u1ec7u. V\u1edbi h\u1ec7 th\u1ed1ng x\u00e1c th\u1ef1c \u0111a d\u1ea1ng, Firebase gi\u00fap d\u1ec5 d\u00e0ng b\u1ea3o m\u1eadt v\u00e0 qu\u1ea3n l\u00fd ng\u01b0\u1eddi d\u00f9ng th\u00f4ng qua nhi\u1ec1u ph\u01b0\u01a1ng th\u1ee9c nh\u01b0 email, s\u1ed1 \u0111i\u1ec7n tho\u1ea1i v\u00e0 c\u00e1c n\u1ec1n t\u1ea3ng x\u00e3 h\u1ed9i. B\u00ean c\u1ea1nh \u0111\u00f3, c\u00e1c gi\u1ea3i ph\u00e1p l\u01b0u tr\u1eef d\u1eef li\u1ec7u nh\u01b0 Cloud Firestore v\u00e0 Realtime Database cung c\u1ea5p kh\u1ea3 n\u0103ng \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u theo th\u1eddi gian th\u1ef1c, cho ph\u00e9p \u1ee9ng d\u1ee5ng t\u01b0\u01a1ng t\u00e1c m\u01b0\u1ee3t m\u00e0 v\u00e0 li\u00ean t\u1ee5c c\u1eadp nh\u1eadt th\u00f4ng tin.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Firebase c\u0169ng h\u1ed7 tr\u1ee3 vi\u1ec7c g\u1eedi th\u00f4ng b\u00e1o \u0111\u1ea9y, gi\u00fap \u1ee9ng d\u1ee5ng gi\u1eef li\u00ean l\u1ea1c v\u1edbi ng\u01b0\u1eddi d\u00f9ng ngay c\u1ea3 khi h\u1ecd kh\u00f4ng m\u1edf \u1ee9ng d\u1ee5ng. Kh\u00f4ng ch\u1ec9 v\u1eady, Firebase c\u00f2n cung c\u1ea5p gi\u1ea3i ph\u00e1p l\u01b0u tr\u1eef t\u1ec7p an to\u00e0n, gi\u00fap d\u1ec5 d\u00e0ng qu\u1ea3n l\u00fd c\u00e1c t\u1ec7p l\u1edbn nh\u01b0 \u1ea3nh v\u00e0 video. Cu\u1ed1i c\u00f9ng, Firebase Analytics mang \u0111\u1ebfn kh\u1ea3 n\u0103ng ph\u00e2n t\u00edch s\u00e2u v\u1ec1 h\u00e0nh vi ng\u01b0\u1eddi d\u00f9ng, t\u1eeb \u0111\u00f3 gi\u00fap nh\u00e0 ph\u00e1t tri\u1ec3n t\u1ed1i \u01b0u h\u00f3a tr\u1ea3i nghi\u1ec7m v\u00e0 ph\u00e1t tri\u1ec3n chi\u1ebfn l\u01b0\u1ee3c ph\u00f9 h\u1ee3p cho \u1ee9ng d\u1ee5ng.<\/span><\/p>\n<blockquote><p><em>\u0110\u1ecdc th\u00eam: <a href=\"https:\/\/itviec.com\/blog\/tong-quan-react-native-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>React Native: Chi ti\u1ebft React Native l\u00e0 g\u00ec v\u00e0 C\u00e1ch s\u1eed d\u1ee5ng A-Z<\/strong><\/a><\/em><\/p><\/blockquote>\n<h2><span class=\"ez-toc-section\" id=\"Cac_buoc_chuan_bi_va_cai_dat_Firebase_trong_React_Native\"><\/span><strong>C\u00e1c b\u01b0\u1edbc chu\u1ea9n b\u1ecb v\u00e0 c\u00e0i \u0111\u1eb7t Firebase trong React Native<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c t\u00edch h\u1ee3p Firebase v\u00e0o \u1ee9ng d\u1ee5ng React Native y\u00eau c\u1ea7u m\u1ed9t s\u1ed1 b\u01b0\u1edbc chu\u1ea9n b\u1ecb v\u00e0 c\u00e0i \u0111\u1eb7t c\u1ee5 th\u1ec3 \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 h\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1c b\u01b0\u1edbc t\u1eeb chu\u1ea9n b\u1ecb m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n, t\u1ea1o project Firebase cho \u0111\u1ebfn vi\u1ec7c t\u00edch h\u1ee3p th\u01b0 vi\u1ec7n Firebase v\u00e0o \u1ee9ng d\u1ee5ng React Native.<\/span><\/p>\n<h3><b>C\u00e0i \u0111\u1eb7t m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n\u00a0<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u, b\u1ea1n c\u1ea7n \u0111\u1ea3m b\u1ea3o r\u1eb1ng \u0111\u00e3 c\u00e0i \u0111\u1eb7t \u0111\u1ea7y \u0111\u1ee7 c\u00e1c c\u00f4ng c\u1ee5 ph\u00e1t tri\u1ec3n c\u01a1 b\u1ea3n c\u1ea7n thi\u1ebft \u0111\u1ec3 x\u00e2y d\u1ef1ng \u1ee9ng d\u1ee5ng React Native.<\/span><\/p>\n<h4><b>C\u00e0i \u0111\u1eb7t Node.js<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Node.js l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng JavaScript c\u1ea7n thi\u1ebft \u0111\u1ec3 c\u00e0i \u0111\u1eb7t c\u00e1c g\u00f3i npm (Node Package Manager), bao g\u1ed3m c\u1ea3 React Native v\u00e0 c\u00e1c th\u01b0 vi\u1ec7n li\u00ean quan \u0111\u1ebfn Firebase. B\u1ea1n c\u00f3 th\u1ec3 t\u00ecm hi\u1ec3u th\u00eam v\u1ec1 <a href=\"https:\/\/itviec.com\/blog\/nodejs-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>NodeJS l\u00e0 g\u00ec<\/strong><\/a> qua b\u00e0i vi\u1ebft c\u1ee7a ITviec.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u0110\u1ec3 c\u00e0i \u0111\u1eb7t Node.js:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">T\u1ea3i Node.js t\u1eeb<\/span><a href=\"https:\/\/nodejs.org\/\"> <span style=\"font-weight: 400;\">trang ch\u00ednh th\u1ee9c c\u1ee7a Node.js<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Sau khi c\u00e0i \u0111\u1eb7t, ki\u1ec3m tra phi\u00ean b\u1ea3n \u0111\u00e3 c\u00e0i \u0111\u1eb7t b\u1eb1ng l\u1ec7nh:<\/span><\/li>\n<\/ul>\n<pre>node -v\r\nnpm -v<\/pre>\n<h4><b>C\u00e0i \u0111\u1eb7t React Native CLI ho\u1eb7c Expo<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">React Native cung c\u1ea5p hai c\u00e1ch ti\u1ebfp c\u1eadn: s\u1eed d\u1ee5ng React Native CLI ho\u1eb7c Expo. B\u1ea1n c\u00f3 th\u1ec3 ch\u1ecdn m\u1ed9t trong hai t\u00f9y theo nhu c\u1ea7u ph\u00e1t tri\u1ec3n.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>React Native CLI<\/strong>: \u0110\u00e2y l\u00e0 c\u00e1ch ti\u1ebfp c\u1eadn m\u1ea1nh m\u1ebd h\u01a1n, cho ph\u00e9p b\u1ea1n t\u00f9y ch\u1ec9nh s\u00e2u v\u00e0o code native c\u1ee7a iOS v\u00e0 Android. \u0110\u1ec3 c\u00e0i \u0111\u1eb7t React Native CLI, b\u1ea1n th\u1ef1c hi\u1ec7n:<\/span><\/li>\n<\/ul>\n<pre>npm install -g react-native-cli<\/pre>\n<p><span style=\"font-weight: 400;\">Kh\u1edfi t\u1ea1o m\u1ed9t project React Native m\u1edbi:<\/span><\/p>\n<pre>react-native init MyApp<\/pre>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Expo<\/strong>: \u0110\u00e2y l\u00e0 gi\u1ea3i ph\u00e1p nhanh ch\u00f3ng v\u00e0 d\u1ec5 d\u00e0ng cho c\u00e1c d\u1ef1 \u00e1n kh\u00f4ng y\u00eau c\u1ea7u ch\u1ec9nh s\u1eeda nhi\u1ec1u v\u1ec1 m\u00e3 native. \u0110\u1ec3 c\u00e0i \u0111\u1eb7t Expo CLI:<\/span><\/li>\n<\/ul>\n<pre>npm install -g expo-cli<\/pre>\n<p><span style=\"font-weight: 400;\">Kh\u1edfi t\u1ea1o m\u1ed9t project Expo:<\/span><\/p>\n<pre>expo init MyApp<\/pre>\n<h4><b>T\u1ea1o project Firebase<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Sau khi \u0111\u00e3 thi\u1ebft l\u1eadp xong m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n, b\u01b0\u1edbc ti\u1ebfp theo l\u00e0 t\u1ea1o m\u1ed9t project Firebase tr\u00ean Firebase Console \u0111\u1ec3 t\u00edch h\u1ee3p v\u1edbi \u1ee9ng d\u1ee5ng React Native.<\/span><\/p>\n<h4><b>\u0110\u0103ng k\u00fd Firebase<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Truy c\u1eadp <\/span><a href=\"https:\/\/console.firebase.google.com\/u\/0\/\"><span style=\"font-weight: 400;\">Firebase Console<\/span><\/a><span style=\"font-weight: 400;\">, sau \u0111\u00f3 \u0111\u0103ng nh\u1eadp b\u1eb1ng t\u00e0i kho\u1ea3n Google.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Nh\u1ea5n v\u00e0o n\u00fat Create Project \u0111\u1ec3 t\u1ea1o m\u1ed9t d\u1ef1 \u00e1n m\u1edbi.<\/span><\/li>\n<\/ul>\n<h4><b>T\u1ea1o project tr\u00ean Firebase Console<\/b><\/h4>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u0110i\u1ec1n t\u00ean d\u1ef1 \u00e1n v\u00e0 ch\u1ecdn c\u00e1c c\u00e0i \u0111\u1eb7t li\u00ean quan (ch\u1eb3ng h\u1ea1n c\u00f3 th\u1ec3 k\u00edch ho\u1ea1t Google Analytics n\u1ebfu mu\u1ed1n).<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Sau khi t\u1ea1o xong project, b\u1ea1n s\u1ebd \u0111\u01b0\u1ee3c \u0111i\u1ec1u h\u01b0\u1edbng \u0111\u1ebfn b\u1ea3ng \u0111i\u1ec1u khi\u1ec3n qu\u1ea3n l\u00fd Firebase.<\/span><\/li>\n<\/ul>\n<h4><b>Th\u00eam \u1ee9ng d\u1ee5ng v\u00e0o project Firebase<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Sau khi t\u1ea1o xong project Firebase, b\u1ea1n c\u1ea7n th\u00eam \u1ee9ng d\u1ee5ng v\u00e0o project:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">iOS: Ch\u1ecdn bi\u1ec3u t\u01b0\u1ee3ng Apple v\u00e0 \u0111i\u1ec1n c\u00e1c th\u00f4ng tin c\u1ea7n thi\u1ebft nh\u01b0 Bundle ID. Sau \u0111\u00f3 t\u1ea3i file GoogleService-Info.plist v\u1ec1 v\u00e0 th\u00eam v\u00e0o th\u01b0 m\u1ee5c iOS c\u1ee7a \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Android: Ch\u1ecdn bi\u1ec3u t\u01b0\u1ee3ng Android v\u00e0 \u0111i\u1ec1n c\u00e1c th\u00f4ng tin nh\u01b0 package name. T\u1ea3i file google-services.json v\u00e0 \u0111\u1eb7t v\u00e0o th\u01b0 m\u1ee5c android\/app c\u1ee7a d\u1ef1 \u00e1n.<\/span><\/li>\n<\/ul>\n<h3><b>C\u00e0i \u0111\u1eb7t th\u01b0 vi\u1ec7n Firebase trong React Native<\/b><\/h3>\n<p><b>@<\/b><b>react-native-firebase<\/b><span style=\"font-weight: 400;\"> l\u00e0 <a href=\"https:\/\/rnfirebase.io\/\" target=\"_blank\" rel=\"noopener\">th\u01b0 vi\u1ec7n ch\u00ednh th\u1ee9c<\/a> \u0111\u01b0\u1ee3c d\u00f9ng \u0111\u1ec3 t\u00edch h\u1ee3p Firebase v\u00e0o React Native. \u0110\u1ec3 c\u00e0i \u0111\u1eb7t th\u01b0 vi\u1ec7n n\u00e0y, b\u1ea1n l\u00e0m theo c\u00e1c b\u01b0\u1edbc sau:<\/span><\/p>\n<h3><strong>C\u00e0i \u0111\u1eb7t Core SDK<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Core SDK l\u00e0 b\u1eaft bu\u1ed9c \u0111\u1ec3 s\u1eed d\u1ee5ng Firebase trong \u1ee9ng d\u1ee5ng React Native. Th\u1ef1c hi\u1ec7n l\u1ec7nh sau:<\/span><\/p>\n<pre>npm install @react-native-firebase\/app<\/pre>\n<h3><strong>Li\u00ean k\u1ebft Firebase SDK v\u00e0o d\u1ef1 \u00e1n<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">V\u1edbi <strong>React Native CLI<\/strong>, sau khi c\u00e0i \u0111\u1eb7t th\u01b0 vi\u1ec7n, b\u1ea1n c\u1ea7n ch\u1ea1y l\u1ec7nh li\u00ean k\u1ebft (link) v\u1edbi \u1ee9ng d\u1ee5ng:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">npx react-native run-android\u00a0<\/span>\r\n\r\n<span style=\"font-weight: 400;\">npx react-native run-ios<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">V\u1edbi <strong>Expo<\/strong>, b\u1ea1n c\u1ea7n eject d\u1ef1 \u00e1n ra kh\u1ecfi m\u00f4i tr\u01b0\u1eddng Expo n\u1ebfu mu\u1ed1n s\u1eed d\u1ee5ng to\u00e0n b\u1ed9 c\u00e1c d\u1ecbch v\u1ee5 Firebase native:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">expo eject<\/span><\/pre>\n<h3><strong>C\u00e0i \u0111\u1eb7t c\u00e1c m\u00f4-\u0111un Firebase kh\u00e1c<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Tu\u1ef3 thu\u1ed9c v\u00e0o c\u00e1c d\u1ecbch v\u1ee5 Firebase m\u00e0 b\u1ea1n mu\u1ed1n s\u1eed d\u1ee5ng, b\u1ea1n c\u1ea7n c\u00e0i \u0111\u1eb7t th\u00eam c\u00e1c m\u00f4-\u0111un t\u01b0\u01a1ng \u1ee9ng:<\/span><\/p>\n<p><b>Firebase Authentication<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">npm install @react-native-firebase\/auth<\/span><\/pre>\n<p><b>Cloud Firestore<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">npm install @react-native-firebase\/firestore<\/span><\/pre>\n<p><b>Firebase Cloud Messaging (FCM)<\/b><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">npm install @react-native-firebase\/messaging<\/span><\/pre>\n<h3><strong>C\u1ea5u h\u00ecnh Firebase cho iOS v\u00e0 Android<\/strong><\/h3>\n<h4><strong>Android<\/strong><\/h4>\n<p><span style=\"font-weight: 400;\">M\u1edf file <\/span><span style=\"font-weight: 400;\">android\/build.gradle<\/span><span style=\"font-weight: 400;\">, th\u00eam d\u00f2ng sau v\u00e0o cu\u1ed1i:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">classpath 'com.google.gms:google-services:4.3.10'<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Sau \u0111\u00f3 m\u1edf file <\/span><span style=\"font-weight: 400;\">android\/app\/build.gradle<\/span><span style=\"font-weight: 400;\"> v\u00e0 th\u00eam d\u00f2ng sau v\u00e0o cu\u1ed1i file:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">apply plugin: 'com.google.gms.google-services'<\/span><\/pre>\n<h4><strong>iOS<\/strong><\/h4>\n<p><span style=\"font-weight: 400;\">Ch\u1ea1y l\u1ec7nh d\u01b0\u1edbi \u0111\u00e2y \u0111\u1ec3 c\u1eadp nh\u1eadt Pod cho iOS:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">cd ios\/<\/span>\r\n\r\n<span style=\"font-weight: 400;\">pod install<\/span><\/pre>\n<p><b>T\u00f3m l\u1ea1i\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">C\u00e1c b\u01b0\u1edbc chu\u1ea9n b\u1ecb v\u00e0 c\u00e0i \u0111\u1eb7t Firebase trong React Native bao g\u1ed3m vi\u1ec7c thi\u1ebft l\u1eadp m\u00f4i tr\u01b0\u1eddng ph\u00e1t tri\u1ec3n, t\u1ea1o d\u1ef1 \u00e1n tr\u00ean Firebase Console, v\u00e0 c\u00e0i \u0111\u1eb7t c\u0169ng nh\u01b0 c\u1ea5u h\u00ecnh c\u00e1c th\u01b0 vi\u1ec7n Firebase th\u00f4ng qua <\/span><span style=\"font-weight: 400;\">@react-native-firebase<\/span><span style=\"font-weight: 400;\">. Th\u1ef1c hi\u1ec7n \u0111\u00fang c\u00e1c b\u01b0\u1edbc n\u00e0y s\u1ebd gi\u00fap b\u1ea1n d\u1ec5 d\u00e0ng t\u00edch h\u1ee3p Firebase v\u00e0 khai th\u00e1c s\u1ee9c m\u1ea1nh c\u1ee7a n\u1ec1n t\u1ea3ng n\u00e0y v\u00e0o \u1ee9ng d\u1ee5ng React Native c\u1ee7a m\u00ecnh.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_tinh_nang_Firebase_pho_bien_su_dung_trong_React_Native\"><\/span><strong>C\u00e1c t\u00ednh n\u0103ng Firebase ph\u1ed5 bi\u1ebfn s\u1eed d\u1ee5ng trong React Native\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Firebase cung c\u1ea5p m\u1ed9t lo\u1ea1t c\u00e1c d\u1ecbch v\u1ee5 v\u00e0 t\u00ednh n\u0103ng h\u1eefu \u00edch gi\u00fap c\u1ea3i thi\u1ec7n v\u00e0 t\u1ed1i \u01b0u h\u00f3a qu\u00e1 tr\u00ecnh ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng React Native. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 nh\u1eefng t\u00ednh n\u0103ng Firebase ph\u1ed5 bi\u1ebfn v\u00e0 c\u00e1ch ch\u00fang h\u1ed7 tr\u1ee3 c\u00e1c \u1ee9ng d\u1ee5ng s\u1eed d\u1ee5ng React Native:<\/span><\/p>\n<h3><strong>Firebase Authentication<\/strong><\/h3>\n<p><b>Firebase Authentication<\/b><span style=\"font-weight: 400;\"> gi\u00fap \u0111\u01a1n gi\u1ea3n h\u00f3a qu\u00e1 tr\u00ecnh x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng v\u1edbi c\u00e1c ph\u01b0\u01a1ng th\u1ee9c \u0111\u0103ng nh\u1eadp kh\u00e1c nhau nh\u01b0 email\/password, s\u1ed1 \u0111i\u1ec7n tho\u1ea1i, Google, Facebook, Apple, v\u00e0 nhi\u1ec1u nh\u00e0 cung c\u1ea5p OAuth kh\u00e1c. \u0110\u00e2y l\u00e0 m\u1ed9t gi\u1ea3i ph\u00e1p b\u1ea3o m\u1eadt, d\u1ec5 d\u00e0ng t\u00edch h\u1ee3p, v\u00e0 ti\u1ebft ki\u1ec7m th\u1eddi gian ph\u00e1t tri\u1ec3n h\u1ec7 th\u1ed1ng \u0111\u0103ng nh\u1eadp ng\u01b0\u1eddi d\u00f9ng trong \u1ee9ng d\u1ee5ng React Native.<\/span><\/p>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>\u0110\u0103ng nh\u1eadp v\u00e0 \u0111\u0103ng k\u00fd d\u1ec5 d\u00e0ng<\/b><span style=\"font-weight: 400;\">: Firebase Authentication cung c\u1ea5p m\u1ed9t gi\u1ea3i ph\u00e1p x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng \u0111\u01a1n gi\u1ea3n v\u00e0 an to\u00e0n, h\u1ed7 tr\u1ee3 nhi\u1ec1u ph\u01b0\u01a1ng th\u1ee9c nh\u01b0 email\/password, s\u1ed1 \u0111i\u1ec7n tho\u1ea1i, v\u00e0 \u0111\u0103ng nh\u1eadp qua c\u00e1c m\u1ea1ng x\u00e3 h\u1ed9i nh\u01b0 Google, Facebook, Twitter, GitHub, Apple.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Qu\u1ea3n l\u00fd ng\u01b0\u1eddi d\u00f9ng hi\u1ec7u qu\u1ea3<\/b><span style=\"font-weight: 400;\">: Firebase t\u1ef1 \u0111\u1ed9ng qu\u1ea3n l\u00fd phi\u00ean \u0111\u0103ng nh\u1eadp, l\u01b0u tr\u1eef v\u00e0 \u0111\u1ed3ng b\u1ed9 h\u00f3a tr\u1ea1ng th\u00e1i ng\u01b0\u1eddi d\u00f9ng tr\u00ean nhi\u1ec1u thi\u1ebft b\u1ecb.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p m\u01b0\u1ee3t m\u00e0 v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: Th\u00f4ng qua th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/auth<\/span><span style=\"font-weight: 400;\">, vi\u1ec7c t\u00edch h\u1ee3p Firebase Authentication v\u00e0o \u1ee9ng d\u1ee5ng React Native tr\u1edf n\u00ean \u0111\u01a1n gi\u1ea3n v\u00e0 nhanh ch\u00f3ng.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 t\u00edch h\u1ee3p\u00a0<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import auth from '@react-native-firebase\/auth';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ \u0110\u0103ng k\u00fd ng\u01b0\u1eddi d\u00f9ng m\u1edbi<\/span>\r\n<span style=\"font-weight: 400;\">auth()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.createUserWithEmailAndPassword('email@example.com', 'password123')<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.then(() =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('T\u00e0i kho\u1ea3n ng\u01b0\u1eddi d\u00f9ng \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea1o &amp; \u0111\u0103ng nh\u1eadp th\u00e0nh c\u00f4ng!');<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0})<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.catch(error =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.error(error);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ \u0110\u0103ng nh\u1eadp ng\u01b0\u1eddi d\u00f9ng hi\u1ec7n c\u00f3<\/span>\r\n<span style=\"font-weight: 400;\">auth()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.signInWithEmailAndPassword('email@example.com', 'password123')<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.then(() =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('\u0110\u0103ng nh\u1eadp th\u00e0nh c\u00f4ng!');<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0})<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.catch(error =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.error(error);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span><\/pre>\n<h3><strong>Cloud Firestore v\u00e0 Realtime Database (C\u01a1 s\u1edf d\u1eef li\u1ec7u th\u1eddi gian th\u1ef1c)<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>L\u01b0u tr\u1eef v\u00e0 \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u<\/b><span style=\"font-weight: 400;\">: C\u1ea3 <\/span><b>Cloud Firestore<\/b><span style=\"font-weight: 400;\"> v\u00e0 <\/span><b>Realtime Database<\/b><span style=\"font-weight: 400;\"> cho ph\u00e9p l\u01b0u tr\u1eef d\u1eef li\u1ec7u d\u1ea1ng NoSQL, \u0111\u1ed3ng b\u1ed9 h\u00f3a d\u1eef li\u1ec7u theo th\u1eddi gian th\u1ef1c gi\u1eefa c\u00e1c thi\u1ebft b\u1ecb v\u00e0 ng\u01b0\u1eddi d\u00f9ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng cao<\/b><span style=\"font-weight: 400;\">: H\u1ed7 tr\u1ee3 m\u1edf r\u1ed9ng linh ho\u1ea1t, ph\u00f9 h\u1ee3p v\u1edbi c\u00e1c \u1ee9ng d\u1ee5ng t\u1eeb nh\u1ecf \u0111\u1ebfn l\u1edbn.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>B\u1ea3o m\u1eadt v\u00e0 quy\u1ec1n truy c\u1eadp<\/b><span style=\"font-weight: 400;\">: Cung c\u1ea5p c\u00e1c quy t\u1eafc b\u1ea3o m\u1eadt linh ho\u1ea1t, gi\u00fap ki\u1ec3m so\u00e1t truy c\u1eadp v\u00e0o d\u1eef li\u1ec7u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p d\u1ec5 d\u00e0ng v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng c\u00e1c th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/firestore<\/span><span style=\"font-weight: 400;\"> v\u00e0 <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/database<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 t\u01b0\u01a1ng t\u00e1c v\u1edbi c\u01a1 s\u1edf d\u1eef li\u1ec7u.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 s\u1eed d\u1ee5ng Cloud Firestore:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import firestore from '@react-native-firebase\/firestore';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Th\u00eam m\u1ed9t t\u00e0i li\u1ec7u m\u1edbi v\u00e0o collection 'Users'<\/span>\r\n<span style=\"font-weight: 400;\">firestore()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.collection('Users')<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.add({<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0name: 'Nguy\u1ec5n V\u0103n A',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0email: 'nguyenvana@example.com',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0age: 25,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0})<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.then(() =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('Ng\u01b0\u1eddi d\u00f9ng m\u1edbi \u0111\u00e3 \u0111\u01b0\u1ee3c th\u00eam!');<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ L\u1eafng nghe thay \u0111\u1ed5i trong collection 'Users'<\/span>\r\n<span style=\"font-weight: 400;\">const subscriber = firestore()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.collection('Users')<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.onSnapshot(querySnapshot =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0const users = [];<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0querySnapshot.forEach(documentSnapshot =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0users.push({<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0...documentSnapshot.data(),<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0key: documentSnapshot.id,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0});<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0console.log('Ng\u01b0\u1eddi d\u00f9ng hi\u1ec7n t\u1ea1i: ', users);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ D\u1eebng l\u1eafng nghe khi kh\u00f4ng c\u1ea7n thi\u1ebft<\/span>\r\n<span style=\"font-weight: 400;\">subscriber();<\/span><\/pre>\n<h3><strong>Firebase Cloud Messaging (FCM) &#8211; Th\u00f4ng b\u00e1o \u0111\u1ea9y<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>G\u1eedi th\u00f4ng b\u00e1o \u0111\u1ea9y<\/b><span style=\"font-weight: 400;\">: Cho ph\u00e9p g\u1eedi th\u00f4ng b\u00e1o \u0111\u1ebfn ng\u01b0\u1eddi d\u00f9ng ngay c\u1ea3 khi \u1ee9ng d\u1ee5ng \u0111ang ch\u1ea1y n\u1ec1n ho\u1eb7c b\u1ecb \u0111\u00f3ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u01b0\u01a1ng t\u00e1c ng\u01b0\u1eddi d\u00f9ng<\/b><span style=\"font-weight: 400;\">: T\u0103ng c\u01b0\u1eddng s\u1ef1 t\u01b0\u01a1ng t\u00e1c v\u00e0 gi\u1eef ch\u00e2n ng\u01b0\u1eddi d\u00f9ng b\u1eb1ng c\u00e1ch g\u1eedi th\u00f4ng b\u00e1o v\u1ec1 c\u1eadp nh\u1eadt, khuy\u1ebfn m\u00e3i, ho\u1eb7c nh\u1eafc nh\u1edf.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: Th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/messaging<\/span><span style=\"font-weight: 400;\"> h\u1ed7 tr\u1ee3 vi\u1ec7c nh\u1eadn v\u00e0 x\u1eed l\u00fd th\u00f4ng b\u00e1o \u0111\u1ea9y trong \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 t\u00edch h\u1ee3p FCM:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import messaging from '@react-native-firebase\/messaging';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Xin quy\u1ec1n nh\u1eadn th\u00f4ng b\u00e1o (\u0111\u1ed1i v\u1edbi iOS)<\/span>\r\n<span style=\"font-weight: 400;\">async function requestUserPermission() {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0const authStatus = await messaging().requestPermission();<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0const enabled =<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0authStatus === messaging.AuthorizationStatus.AUTHORIZED ||<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0authStatus === messaging.AuthorizationStatus.PROVISIONAL;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0if (enabled) {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('Quy\u1ec1n th\u00f4ng b\u00e1o \u0111\u01b0\u1ee3c c\u1ea5p:', authStatus);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Nh\u1eadn token FCM<\/span>\r\n<span style=\"font-weight: 400;\">messaging()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.getToken()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.then(token =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('FCM Token:', token);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\/\/ G\u1eedi token n\u00e0y \u0111\u1ebfn server c\u1ee7a b\u1ea1n \u0111\u1ec3 l\u01b0u tr\u1eef v\u00e0 s\u1eed d\u1ee5ng<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ L\u1eafng nghe th\u00f4ng b\u00e1o khi \u1ee9ng d\u1ee5ng \u0111ang \u1edf foreground<\/span>\r\n<span style=\"font-weight: 400;\">messaging().onMessage(async remoteMessage =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0Alert.alert('Th\u00f4ng b\u00e1o m\u1edbi!', remoteMessage.notification.body);<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ G\u1ecdi h\u00e0m xin quy\u1ec1n khi \u1ee9ng d\u1ee5ng kh\u1edfi \u0111\u1ed9ng<\/span>\r\n<span style=\"font-weight: 400;\">requestUserPermission();<\/span><\/pre>\n<h3><strong>Firebase Storage (L\u01b0u tr\u1eef t\u1ec7p)<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>L\u01b0u tr\u1eef t\u1ec7p an to\u00e0n<\/b><span style=\"font-weight: 400;\">: Cho ph\u00e9p l\u01b0u tr\u1eef v\u00e0 truy xu\u1ea5t c\u00e1c t\u1ec7p nh\u01b0 h\u00ecnh \u1ea3nh, video, \u00e2m thanh, v\u00e0 c\u00e1c t\u00e0i li\u1ec7u kh\u00e1c.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Quy\u1ec1n truy c\u1eadp linh ho\u1ea1t<\/b><span style=\"font-weight: 400;\">: K\u1ebft h\u1ee3p v\u1edbi Firebase Authentication \u0111\u1ec3 ki\u1ec3m so\u00e1t quy\u1ec1n truy c\u1eadp v\u00e0o t\u1ec7p tin.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/storage<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 t\u1ea3i l\u00ean v\u00e0 t\u1ea3i xu\u1ed1ng t\u1ec7p tin t\u1eeb \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 t\u1ea3i l\u00ean t\u1ec7p h\u00ecnh \u1ea3nh:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import storage from '@react-native-firebase\/storage';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ \u0110\u01b0\u1eddng d\u1eabn t\u1ec7p tr\u00ean thi\u1ebft b\u1ecb (v\u00ed d\u1ee5: t\u1ec7p h\u00ecnh \u1ea3nh \u0111\u00e3 ch\u1ecdn)<\/span>\r\n<span style=\"font-weight: 400;\">const localFile = '\/path\/to\/local\/image.jpg';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ T\u1ea1o tham chi\u1ebfu \u0111\u1ebfn v\u1ecb tr\u00ed l\u01b0u tr\u1eef tr\u00ean Firebase Storage<\/span>\r\n<span style=\"font-weight: 400;\">const reference = storage().ref('images\/userProfile.jpg');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ T\u1ea3i l\u00ean t\u1ec7p<\/span>\r\n<span style=\"font-weight: 400;\">const task = reference.putFile(localFile);<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ L\u1eafng nghe tr\u1ea1ng th\u00e1i t\u1ea3i l\u00ean<\/span>\r\n<span style=\"font-weight: 400;\">task.on('state_changed', taskSnapshot =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0console.log(<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0`${taskSnapshot.bytesTransferred} transferred out of ${taskSnapshot.totalBytes}`,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0);<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ X\u1eed l\u00fd khi t\u1ea3i l\u00ean ho\u00e0n t\u1ea5t<\/span>\r\n<span style=\"font-weight: 400;\">task.then(() =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0console.log('T\u1ea3i l\u00ean ho\u00e0n t\u1ea5t!');<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span><\/pre>\n<h3><strong>Firebase Analytics<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Theo d\u00f5i h\u00e0nh vi ng\u01b0\u1eddi d\u00f9ng<\/b><span style=\"font-weight: 400;\">: Thu th\u1eadp d\u1eef li\u1ec7u v\u1ec1 c\u00e1ch ng\u01b0\u1eddi d\u00f9ng t\u01b0\u01a1ng t\u00e1c v\u1edbi \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ph\u00e2n t\u00edch v\u00e0 t\u1ed1i \u01b0u h\u00f3a<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng d\u1eef li\u1ec7u \u0111\u1ec3 c\u1ea3i thi\u1ec7n tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng v\u00e0 hi\u1ec7u su\u1ea5t \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p d\u1ec5 d\u00e0ng<\/b><span style=\"font-weight: 400;\">: Th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/analytics<\/span><span style=\"font-weight: 400;\"> cho ph\u00e9p ghi l\u1ea1i c\u00e1c s\u1ef1 ki\u1ec7n v\u00e0 thu\u1ed9c t\u00ednh t\u00f9y ch\u1ec9nh.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 ghi l\u1ea1i s\u1ef1 ki\u1ec7n t\u00f9y ch\u1ec9nh:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import analytics from '@react-native-firebase\/analytics';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Ghi l\u1ea1i s\u1ef1 ki\u1ec7n xem s\u1ea3n ph\u1ea9m<\/span>\r\n<span style=\"font-weight: 400;\">await analytics().logEvent('product_view', {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0product_id: 'P12345',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0product_name: '\u00c1o thun nam',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0category: 'Th\u1eddi trang',<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ \u0110\u1eb7t thu\u1ed9c t\u00ednh ng\u01b0\u1eddi d\u00f9ng<\/span>\r\n<span style=\"font-weight: 400;\">await analytics().setUserProperty('favorite_category', 'Th\u1eddi trang');<\/span><\/pre>\n<h3><strong>Firebase Crashlytics<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Theo d\u00f5i l\u1ed7i v\u00e0 crash<\/b><span style=\"font-weight: 400;\">: T\u1ef1 \u0111\u1ed9ng ghi l\u1ea1i c\u00e1c l\u1ed7i v\u00e0 crash x\u1ea3y ra trong \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>B\u00e1o c\u00e1o chi ti\u1ebft<\/b><span style=\"font-weight: 400;\">: Cung c\u1ea5p th\u00f4ng tin chi ti\u1ebft v\u1ec1 ng\u1eef c\u1ea3nh, gi\u00fap nhanh ch\u00f3ng x\u00e1c \u0111\u1ecbnh v\u00e0 s\u1eeda l\u1ed7i.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/crashlytics<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 k\u00edch ho\u1ea1t Crashlytics.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 ghi l\u1ea1i l\u1ed7i t\u00f9y ch\u1ec9nh:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import crashlytics from '@react-native-firebase\/crashlytics';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Ghi l\u1ea1i m\u1ed9t l\u1ed7i kh\u00f4ng nghi\u00eam tr\u1ecdng<\/span>\r\n<span style=\"font-weight: 400;\">crashlytics().log('Ng\u01b0\u1eddi d\u00f9ng g\u1eb7p l\u1ed7i khi t\u1ea3i h\u00ecnh \u1ea3nh.');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Ghi l\u1ea1i l\u1ed7i v\u1edbi stack trace<\/span>\r\n<span style=\"font-weight: 400;\">try {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\/\/ M\u00e3 c\u00f3 th\u1ec3 g\u00e2y ra l\u1ed7i<\/span>\r\n<span style=\"font-weight: 400;\">} catch (error) {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0crashlytics().recordError(error);<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ B\u1eaft bu\u1ed9c \u1ee9ng d\u1ee5ng crash (ch\u1ec9 d\u00f9ng trong ph\u00e1t tri\u1ec3n)<\/span>\r\n<span style=\"font-weight: 400;\">crashlytics().crash();<\/span><\/pre>\n<h3><strong>Firebase Remote Config<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>C\u1eadp nh\u1eadt c\u1ea5u h\u00ecnh t\u1eeb xa<\/b><span style=\"font-weight: 400;\">: Thay \u0111\u1ed5i giao di\u1ec7n v\u00e0 h\u00e0nh vi c\u1ee7a \u1ee9ng d\u1ee5ng m\u00e0 kh\u00f4ng c\u1ea7n c\u1eadp nh\u1eadt t\u1eeb App Store ho\u1eb7c Google Play.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ph\u00e2n \u0111o\u1ea1n ng\u01b0\u1eddi d\u00f9ng<\/b><span style=\"font-weight: 400;\">: T\u00f9y ch\u1ec9nh tr\u1ea3i nghi\u1ec7m cho c\u00e1c nh\u00f3m ng\u01b0\u1eddi d\u00f9ng kh\u00e1c nhau d\u1ef1a tr\u00ean \u0111i\u1ec1u ki\u1ec7n c\u1ee5 th\u1ec3.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/remote-config<\/span><span style=\"font-weight: 400;\"> \u0111\u1ec3 truy c\u1eadp v\u00e0 qu\u1ea3n l\u00fd c\u00e1c gi\u00e1 tr\u1ecb c\u1ea5u h\u00ecnh.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 s\u1eed d\u1ee5ng Remote Config:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import remoteConfig from '@react-native-firebase\/remote-config';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Thi\u1ebft l\u1eadp gi\u00e1 tr\u1ecb m\u1eb7c \u0111\u1ecbnh<\/span>\r\n<span style=\"font-weight: 400;\">await remoteConfig().setDefaults({<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0welcome_message: 'Ch\u00e0o m\u1eebng b\u1ea1n \u0111\u1ebfn v\u1edbi \u1ee9ng d\u1ee5ng c\u1ee7a ch\u00fang t\u00f4i!',<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ L\u1ea5y gi\u00e1 tr\u1ecb c\u1ea5u h\u00ecnh t\u1eeb m\u00e1y ch\u1ee7<\/span>\r\n<span style=\"font-weight: 400;\">await remoteConfig().fetchAndActivate();<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Truy xu\u1ea5t gi\u00e1 tr\u1ecb c\u1ea5u h\u00ecnh<\/span>\r\n<span style=\"font-weight: 400;\">const welcomeMessage = remoteConfig().getValue('welcome_message').asString();<\/span>\r\n\r\n<span style=\"font-weight: 400;\">console.log('Th\u00f4ng \u0111i\u1ec7p ch\u00e0o m\u1eebng:', welcomeMessage);<\/span><\/pre>\n<h3><strong>Firebase Performance Monitoring<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Gi\u00e1m s\u00e1t hi\u1ec7u su\u1ea5t \u1ee9ng d\u1ee5ng<\/b><span style=\"font-weight: 400;\">: Theo d\u00f5i th\u1eddi gian kh\u1edfi \u0111\u1ed9ng, \u0111\u1ed9 tr\u1ec5 m\u1ea1ng, v\u00e0 c\u00e1c v\u1ea5n \u0111\u1ec1 hi\u1ec7u su\u1ea5t kh\u00e1c.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>C\u1ea3i thi\u1ec7n tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng<\/b><span style=\"font-weight: 400;\">: S\u1eed d\u1ee5ng d\u1eef li\u1ec7u hi\u1ec7u su\u1ea5t \u0111\u1ec3 t\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u00edch h\u1ee3p v\u1edbi React Native<\/b><span style=\"font-weight: 400;\">: Th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">@react-native-firebase\/perf<\/span><span style=\"font-weight: 400;\"> gi\u00fap k\u00edch ho\u1ea1t v\u00e0 t\u00f9y ch\u1ec9nh vi\u1ec7c theo d\u00f5i hi\u1ec7u su\u1ea5t.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 t\u1ea1o trace t\u00f9y ch\u1ec9nh:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import perf from '@react-native-firebase\/perf';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ B\u1eaft \u0111\u1ea7u trace t\u00f9y ch\u1ec9nh<\/span>\r\n<span style=\"font-weight: 400;\">const trace = await perf().startTrace('custom_trace');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ Th\u1ef1c hi\u1ec7n m\u1ed9t s\u1ed1 c\u00f4ng vi\u1ec7c c\u1ea7n \u0111o l\u01b0\u1eddng<\/span>\r\n<span style=\"font-weight: 400;\">\/\/ ...<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ K\u1ebft th\u00fac trace<\/span>\r\n<span style=\"font-weight: 400;\">await trace.stop();<\/span><\/pre>\n<h3><strong>Firebase Cloud Functions<\/strong><\/h3>\n<p><b>C\u00e1ch h\u1ed7 tr\u1ee3 trong React Native:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Logic ph\u00eda m\u00e1y ch\u1ee7 kh\u00f4ng c\u1ea7n qu\u1ea3n l\u00fd server<\/b><span style=\"font-weight: 400;\">: Vi\u1ebft v\u00e0 tri\u1ec3n khai c\u00e1c ch\u1ee9c n\u0103ng backend m\u00e0 kh\u00f4ng c\u1ea7n qu\u1ea3n l\u00fd c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>X\u1eed l\u00fd s\u1ef1 ki\u1ec7n t\u1ef1 \u0111\u1ed9ng<\/b><span style=\"font-weight: 400;\">: T\u1ef1 \u0111\u1ed9ng ph\u1ea3n \u1ee9ng v\u1edbi c\u00e1c s\u1ef1 ki\u1ec7n t\u1eeb Authentication, Firestore, Realtime Database, Storage, v\u00e0 c\u00e1c d\u1ecbch v\u1ee5 Firebase kh\u00e1c.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>T\u01b0\u01a1ng t\u00e1c t\u1eeb \u1ee9ng d\u1ee5ng<\/b><span style=\"font-weight: 400;\">: \u1ee8ng d\u1ee5ng React Native c\u00f3 th\u1ec3 g\u1ecdi tr\u1ef1c ti\u1ebfp c\u00e1c h\u00e0m Cloud Functions th\u00f4ng qua HTTPS ho\u1eb7c SDK.<\/span><\/li>\n<\/ul>\n<p><b>V\u00ed d\u1ee5 g\u1ecdi Cloud Function:<\/b><\/p>\n<pre><span style=\"font-weight: 400;\">import functions from '@react-native-firebase\/functions';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ G\u1ecdi h\u00e0m 'addUser' tr\u00ean Cloud Functions<\/span>\r\n<span style=\"font-weight: 400;\">functions()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.httpsCallable('addUser')({<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0name: 'Nguy\u1ec5n V\u0103n B',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0email: 'nguyenvanb@example.com',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0})\r\n<\/span><span style=\"font-weight: 400;\"> \u00a0.then(response =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('K\u1ebft qu\u1ea3 t\u1eeb Cloud Function:', response.data);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0})<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.catch(error =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.error('L\u1ed7i khi g\u1ecdi Cloud Function:', error);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span><\/pre>\n<p><b>T\u00f3m l\u1ea1i<\/b><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">C\u00e1c t\u00ednh n\u0103ng ph\u1ed5 bi\u1ebfn c\u1ee7a Google Firebase \u0111\u00f3ng vai tr\u00f2 quan tr\u1ecdng trong vi\u1ec7c h\u1ed7 tr\u1ee3 v\u00e0 n\u00e2ng cao ch\u1ea5t l\u01b0\u1ee3ng \u1ee9ng d\u1ee5ng React Native. Ch\u00fang cung c\u1ea5p gi\u1ea3i ph\u00e1p to\u00e0n di\u1ec7n cho c\u00e1c v\u1ea5n \u0111\u1ec1 th\u01b0\u1eddng g\u1eb7p trong ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng di \u0111\u1ed9ng, bao g\u1ed3m:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>X\u00e1c th\u1ef1c v\u00e0 qu\u1ea3n l\u00fd ng\u01b0\u1eddi d\u00f9ng<\/b><span style=\"font-weight: 400;\"> v\u1edbi Firebase Authentication.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>L\u01b0u tr\u1eef v\u00e0 \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u th\u1eddi gian th\u1ef1c<\/b><span style=\"font-weight: 400;\"> th\u00f4ng qua Cloud Firestore v\u00e0 Realtime Database.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>G\u1eedi th\u00f4ng b\u00e1o \u0111\u1ea9y<\/b><span style=\"font-weight: 400;\"> \u0111\u1ebfn ng\u01b0\u1eddi d\u00f9ng v\u1edbi Firebase Cloud Messaging.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>L\u01b0u tr\u1eef t\u1ec7p tin<\/b><span style=\"font-weight: 400;\"> m\u1ed9t c\u00e1ch an to\u00e0n v\u00e0 hi\u1ec7u qu\u1ea3 v\u1edbi Firebase Storage.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ph\u00e2n t\u00edch h\u00e0nh vi ng\u01b0\u1eddi d\u00f9ng<\/b><span style=\"font-weight: 400;\"> v\u00e0 <\/span><b>theo d\u00f5i hi\u1ec7u su\u1ea5t<\/b><span style=\"font-weight: 400;\"> b\u1eb1ng Firebase Analytics v\u00e0 Performance Monitoring.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ph\u00e1t hi\u1ec7n v\u00e0 s\u1eeda l\u1ed7i nhanh ch\u00f3ng<\/b><span style=\"font-weight: 400;\"> nh\u1edd Firebase Crashlytics.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>C\u1eadp nh\u1eadt c\u1ea5u h\u00ecnh \u1ee9ng d\u1ee5ng t\u1eeb xa<\/b><span style=\"font-weight: 400;\"> v\u1edbi Firebase Remote Config.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>X\u1eed l\u00fd logic backend<\/b><span style=\"font-weight: 400;\"> m\u00e0 kh\u00f4ng c\u1ea7n qu\u1ea3n l\u00fd server v\u1edbi Firebase Cloud Functions.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c t\u00edch h\u1ee3p Firebase v\u00e0o \u1ee9ng d\u1ee5ng React Native gi\u00fap c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n t\u1eadp trung h\u01a1n v\u00e0o vi\u1ec7c x\u00e2y d\u1ef1ng t\u00ednh n\u0103ng v\u00e0 tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng, gi\u1ea3m thi\u1ec3u th\u1eddi gian v\u00e0 c\u00f4ng s\u1ee9c cho vi\u1ec7c qu\u1ea3n l\u00fd backend v\u00e0 c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng. Th\u01b0 vi\u1ec7n <\/span><span style=\"font-weight: 400;\">@react-native-firebase<\/span><span style=\"font-weight: 400;\"> cung c\u1ea5p c\u00e1c module chuy\u00ean bi\u1ec7t cho t\u1eebng d\u1ecbch v\u1ee5, gi\u00fap vi\u1ec7c t\u00edch h\u1ee3p tr\u1edf n\u00ean d\u1ec5 d\u00e0ng v\u00e0 hi\u1ec7u qu\u1ea3.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Huong_dan_toi_uu_hoa_ung_dung_su_dung_React_Native_voi_Firebase\"><\/span><strong>H\u01b0\u1edbng d\u1eabn t\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng s\u1eed d\u1ee5ng React Native v\u1edbi Firebase<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Firebase kh\u00f4ng ch\u1ec9 cung c\u1ea5p c\u00e1c d\u1ecbch v\u1ee5 m\u1ea1nh m\u1ebd h\u1ed7 tr\u1ee3 ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng m\u00e0 c\u00f2n c\u00f3 nhi\u1ec1u c\u00f4ng c\u1ee5 gi\u00fap t\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng React Native c\u1ea3 v\u1ec1 hi\u1ec7u su\u1ea5t, b\u1ea3o m\u1eadt v\u00e0 kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng. D\u01b0\u1edbi \u0111\u00e2y l\u00e0 c\u00e1c ph\u01b0\u01a1ng ph\u00e1p v\u00e0 h\u01b0\u1edbng d\u1eabn t\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng React Native khi k\u1ebft h\u1ee3p v\u1edbi Firebase.<\/span><\/p>\n<h3><strong>C\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t \u1ee9ng d\u1ee5ng: S\u1eed d\u1ee5ng Firebase Performance Monitoring<\/strong><\/h3>\n<p><b>Firebase Performance Monitoring<\/b><span style=\"font-weight: 400;\"> l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd gi\u00fap theo d\u00f5i hi\u1ec7u su\u1ea5t \u1ee9ng d\u1ee5ng theo th\u1eddi gian th\u1ef1c, t\u1eeb \u0111\u00f3 ph\u00e1t hi\u1ec7n c\u00e1c v\u1ea5n \u0111\u1ec1 nh\u01b0 th\u1eddi gian kh\u1edfi \u0111\u1ed9ng l\u00e2u, \u0111\u1ed9 tr\u1ec5 m\u1ea1ng, v\u00e0 t\u1ed1i \u01b0u h\u00f3a tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng.<\/span><\/p>\n<p>C\u00e1c b\u01b0\u1edbc t\u1ed1i \u01b0u h\u00f3a hi\u1ec7u su\u1ea5t:<\/p>\n<h4><b>C\u1ea5u h\u00ecnh Firebase Performance Monitoring<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">\u0110\u1ea7u ti\u00ean, b\u1ea1n c\u1ea7n c\u1ea5u h\u00ecnh th\u01b0 vi\u1ec7n Performance Monitoring trong \u1ee9ng d\u1ee5ng React Native b\u1eb1ng c\u00e1ch c\u00e0i \u0111\u1eb7t th\u01b0 vi\u1ec7n:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">npm install @react-native-firebase\/perf<\/span><\/pre>\n<h4><b>Theo d\u00f5i th\u1eddi gian kh\u1edfi \u0111\u1ed9ng \u1ee9ng d\u1ee5ng<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u1ef1 \u0111\u1ed9ng theo d\u00f5i th\u1eddi gian kh\u1edfi \u0111\u1ed9ng \u1ee9ng d\u1ee5ng v\u00e0 c\u00e1c s\u1ef1 ki\u1ec7n m\u1ea1ng, ho\u1eb7c t\u1ea1o c\u00e1c &#8220;trace&#8221; t\u00f9y ch\u1ec9nh \u0111\u1ec3 \u0111o l\u01b0\u1eddng c\u00e1c qu\u00e1 tr\u00ecnh c\u1ee5 th\u1ec3. V\u00ed d\u1ee5, \u0111o th\u1eddi gian t\u1ea3i d\u1eef li\u1ec7u t\u1eeb m\u1ed9t API:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import perf from '@react-native-firebase\/perf';\u00a0<\/span>\r\n\r\n<span style=\"font-weight: 400;\">const trace = await perf().startTrace('load_api_data');<\/span><\/pre>\n<h4><b>Gi\u00e1m s\u00e1t hi\u1ec7u su\u1ea5t m\u1ea1ng<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Performance Monitoring t\u1ef1 \u0111\u1ed9ng gi\u00e1m s\u00e1t c\u00e1c y\u00eau c\u1ea7u HTTP\/HTTPS, ghi l\u1ea1i \u0111\u1ed9 tr\u1ec5, t\u1ed1c \u0111\u1ed9 t\u1ea3i xu\u1ed1ng v\u00e0 t\u1ea3i l\u00ean c\u0169ng nh\u01b0 c\u00e1c l\u1ed7i li\u00ean quan. Nh\u1edd \u0111\u00f3, b\u1ea1n c\u00f3 th\u1ec3 nhanh ch\u00f3ng nh\u1eadn di\u1ec7n v\u00e0 kh\u1eafc ph\u1ee5c c\u00e1c v\u1ea5n \u0111\u1ec1 v\u1ec1 m\u1ea1ng c\u00f3 th\u1ec3 \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">L\u1ee3i \u00edch:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">N\u00e2ng cao kh\u1ea3 n\u0103ng ph\u1ea3n h\u1ed3i c\u1ee7a \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">C\u1ea3i thi\u1ec7n th\u1eddi gian t\u1ea3i v\u00e0 kh\u1edfi \u0111\u1ed9ng \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Gi\u1ea3m \u0111\u1ed9 tr\u1ec5 khi truy xu\u1ea5t d\u1eef li\u1ec7u.<\/span><\/li>\n<\/ol>\n<h3><b>B\u1ea3o m\u1eadt d\u1eef li\u1ec7u: S\u1eed d\u1ee5ng Firebase Security Rules v\u00e0 Authentication<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">B\u1ea3o m\u1eadt lu\u00f4n l\u00e0 \u01b0u ti\u00ean h\u00e0ng \u0111\u1ea7u, nh\u1ea5t l\u00e0 khi \u1ee9ng d\u1ee5ng c\u1ee7a b\u1ea1n l\u01b0u tr\u1eef th\u00f4ng tin nh\u1ea1y c\u1ea3m c\u1ee7a ng\u01b0\u1eddi d\u00f9ng. Firebase cung c\u1ea5p c\u00e1c gi\u1ea3i ph\u00e1p nh\u01b0 <\/span><b>Firebase Authentication<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng, v\u00e0 <\/span><b>Firebase Security Rules<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o an to\u00e0n cho d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">C\u00e1c b\u01b0\u1edbc b\u1ea3o m\u1eadt d\u1eef li\u1ec7u:<\/span><\/p>\n<h4><b>\u00c1p d\u1ee5ng Firebase Authentication<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Firebase Authentication cho ph\u00e9p x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng qua nhi\u1ec1u ph\u01b0\u01a1ng th\u1ee9c nh\u01b0 email, s\u1ed1 \u0111i\u1ec7n tho\u1ea1i, v\u00e0 c\u00e1c m\u1ea1ng x\u00e3 h\u1ed9i (Google, Facebook). \u0110i\u1ec1u n\u00e0y cho ph\u00e9p b\u1ea1n qu\u1ea3n l\u00fd quy\u1ec1n truy c\u1eadp c\u1ee7a ng\u01b0\u1eddi d\u00f9ng, \u0111\u1ea3m b\u1ea3o ch\u1ec9 nh\u1eefng ng\u01b0\u1eddi \u0111\u00e3 \u0111\u01b0\u1ee3c x\u00e1c th\u1ef1c m\u1edbi c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n c\u00e1c thao t\u00e1c quan tr\u1ecdng li\u00ean quan \u0111\u1ebfn d\u1eef li\u1ec7u.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">```javascript<\/span>\r\n<span style=\"font-weight: 400;\">import auth from '@react-native-firebase\/auth';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\/\/ \u0110\u0103ng k\u00fd ng\u01b0\u1eddi d\u00f9ng m\u1edbi<\/span>\r\n<span style=\"font-weight: 400;\">auth().createUserWithEmailAndPassword('email@example.com', 'password123')<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.then(() =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.log('Ng\u01b0\u1eddi d\u00f9ng \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea1o th\u00e0nh c\u00f4ng');<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0})<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0.catch(error =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0console.error('L\u1ed7i khi t\u1ea1o ng\u01b0\u1eddi d\u00f9ng:', error);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span><\/pre>\n<h4><b>Thi\u1ebft l\u1eadp Firebase Security Rule<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Firebase cung c\u1ea5p c\u00e1c quy t\u1eafc b\u1ea3o m\u1eadt cho <\/span><b>Cloud Firestore<\/b><span style=\"font-weight: 400;\">, <\/span><b>Realtime Database<\/b><span style=\"font-weight: 400;\">, v\u00e0 <\/span><b>Firebase Storage<\/b><span style=\"font-weight: 400;\">. B\u1ea1n c\u00f3 th\u1ec3 c\u1ea5u h\u00ecnh c\u00e1c quy t\u1eafc \u0111\u1ec3 ch\u1ec9 cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng x\u00e1c th\u1ef1c c\u00f3 quy\u1ec1n \u0111\u1ecdc\/ghi d\u1eef li\u1ec7u:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">\/\/ Quy t\u1eafc b\u1ea3o m\u1eadt cho Firestore<\/span>\r\n<span style=\"font-weight: 400;\">service cloud.firestore {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0match \/databases\/{database}\/documents {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0match \/users\/{userId} {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0allow read, write: if request.auth != null &amp;&amp; request.auth.uid == userId;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Quy t\u1eafc tr\u00ean ch\u1ec9 cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng c\u00f3 ID kh\u1edbp v\u1edbi t\u00e0i li\u1ec7u userId m\u1edbi \u0111\u01b0\u1ee3c ph\u00e9p \u0111\u1ecdc v\u00e0 ghi d\u1eef li\u1ec7u. \u0110i\u1ec1u n\u00e0y \u0111\u1ea3m b\u1ea3o r\u1eb1ng m\u1ed7i ng\u01b0\u1eddi d\u00f9ng ch\u1ec9 c\u00f3 th\u1ec3 truy c\u1eadp d\u1eef li\u1ec7u c\u1ee7a ch\u00ednh h\u1ecd.<\/span><\/p>\n<p><b>L\u1ee3i \u00edch:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">B\u1ea3o v\u1ec7 d\u1eef li\u1ec7u ng\u01b0\u1eddi d\u00f9ng kh\u1ecfi truy c\u1eadp tr\u00e1i ph\u00e9p.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u0110\u1ea3m b\u1ea3o r\u1eb1ng ch\u1ec9 ng\u01b0\u1eddi d\u00f9ng c\u00f3 quy\u1ec1n m\u1edbi c\u00f3 th\u1ec3 thao t\u00e1c v\u1edbi d\u1eef li\u1ec7u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ki\u1ec3m so\u00e1t to\u00e0n di\u1ec7n quy\u1ec1n truy c\u1eadp th\u00f4ng qua c\u00e1c quy t\u1eafc b\u1ea3o m\u1eadt linh ho\u1ea1t.<\/span><\/li>\n<\/ul>\n<h3><strong>Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng: Firebase Functions v\u00e0 t\u00ednh n\u0103ng serverless<\/strong><\/h3>\n<p><b>Firebase Cloud Functions<\/b><span style=\"font-weight: 400;\"> l\u00e0 m\u1ed9t d\u1ecbch v\u1ee5 serverless, cho ph\u00e9p b\u1ea1n tri\u1ec3n khai c\u00e1c ch\u1ee9c n\u0103ng backend m\u00e0 kh\u00f4ng c\u1ea7n qu\u1ea3n l\u00fd m\u00e1y ch\u1ee7. Cloud Functions t\u1ef1 \u0111\u1ed9ng m\u1edf r\u1ed9ng khi \u1ee9ng d\u1ee5ng ph\u00e1t tri\u1ec3n, x\u1eed l\u00fd kh\u1ed1i l\u01b0\u1ee3ng c\u00f4ng vi\u1ec7c l\u1edbn m\u00e0 kh\u00f4ng c\u1ea7n c\u1ea5u h\u00ecnh ho\u1eb7c gi\u00e1m s\u00e1t c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng.<\/span><\/p>\n<p>C\u00e1c b\u01b0\u1edbc s\u1eed d\u1ee5ng Firebase Functions \u0111\u1ec3 m\u1edf r\u1ed9ng \u1ee9ng d\u1ee5ng:<\/p>\n<h4><b>C\u00e0i \u0111\u1eb7t Firebase CLI<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc ti\u00ean, b\u1ea1n c\u1ea7n c\u00e0i \u0111\u1eb7t Firebase CLI \u0111\u1ec3 qu\u1ea3n l\u00fd v\u00e0 tri\u1ec3n khai Cloud Functions:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">npm install -g firebase-tools\u00a0<\/span>\r\n\r\n<span style=\"font-weight: 400;\">firebase login<\/span><\/pre>\n<h4><b>Kh\u1edfi t\u1ea1o Cloud Functions<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Sau khi c\u00e0i \u0111\u1eb7t CLI, b\u1ea1n kh\u1edfi t\u1ea1o Cloud Functions cho d\u1ef1 \u00e1n:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">firebase init functions<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Firebase s\u1ebd t\u1ea1o ra m\u1ed9t m\u00f4i tr\u01b0\u1eddng Node.js \u0111\u1ec3 b\u1ea1n vi\u1ebft c\u00e1c h\u00e0m x\u1eed l\u00fd logic ph\u00eda m\u00e1y ch\u1ee7.<\/span><\/p>\n<h4><b>T\u1ea1o Cloud Function<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u1ea1o m\u1ed9t Cloud Function \u0111\u1ec3 th\u1ef1c hi\u1ec7n c\u00e1c t\u00e1c v\u1ee5 nh\u01b0 g\u1eedi th\u00f4ng b\u00e1o, x\u1eed l\u00fd thanh to\u00e1n, ho\u1eb7c thay \u0111\u1ed5i d\u1eef li\u1ec7u trong c\u01a1 s\u1edf d\u1eef li\u1ec7u. V\u00ed d\u1ee5:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">const functions = require('firebase-functions');<\/span>\r\n<span style=\"font-weight: 400;\">const admin = require('firebase-admin');<\/span>\r\n\r\n<span style=\"font-weight: 400;\">admin.initializeApp();<\/span>\r\n\r\n<span style=\"font-weight: 400;\">exports.addUser = functions.https.onCall((data, context) =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0const { name, email } = data;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0return admin.firestore().collection('users').add({<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0name: name,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0email: email,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0createdAt: admin.firestore.FieldValue.serverTimestamp(),<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0}).then(() =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0return { result: 'Ng\u01b0\u1eddi d\u00f9ng m\u1edbi \u0111\u00e3 \u0111\u01b0\u1ee3c th\u00eam th\u00e0nh c\u00f4ng!' };<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0}).catch(error =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0throw new functions.https.HttpsError('internal', 'L\u1ed7i khi th\u00eam ng\u01b0\u1eddi d\u00f9ng:', error);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0});<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">H\u00e0m tr\u00ean s\u1ebd \u0111\u01b0\u1ee3c g\u1ecdi t\u1eeb \u1ee9ng d\u1ee5ng React Native qua HTTP ho\u1eb7c SDK c\u1ee7a Firebase.<\/span><\/p>\n<h4><b>T\u00edch h\u1ee3p v\u00e0o \u1ee9ng d\u1ee5ng React Native<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 g\u1ecdi Cloud Functions t\u1eeb \u1ee9ng d\u1ee5ng React Native \u0111\u1ec3 th\u1ef1c hi\u1ec7n c\u00e1c t\u00e1c v\u1ee5 backend:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import functions from '@react-native-firebase\/functions';<\/span>\r\n\r\n<span style=\"font-weight: 400;\">functions().httpsCallable('addUser')({<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0name: 'Nguy\u1ec5n V\u0103n A',<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0email: 'nguyenvana@example.com',<\/span>\r\n<span style=\"font-weight: 400;\">})<\/span>\r\n<span style=\"font-weight: 400;\">.then(response =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0console.log('K\u1ebft qu\u1ea3:', response.data.result);<\/span>\r\n<span style=\"font-weight: 400;\">})<\/span>\r\n<span style=\"font-weight: 400;\">.catch(error =&gt; {<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0console.error('L\u1ed7i:', error);<\/span>\r\n<span style=\"font-weight: 400;\">});<\/span><\/pre>\n<p>L\u1ee3i \u00edch:<\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng linh ho\u1ea1t<span style=\"font-weight: 400;\">: Cloud Functions t\u1ef1 \u0111\u1ed9ng m\u1edf r\u1ed9ng theo nhu c\u1ea7u, kh\u00f4ng gi\u1edbi h\u1ea1n kh\u1ed1i l\u01b0\u1ee3ng c\u00f4ng vi\u1ec7c.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Ti\u1ebft ki\u1ec7m chi ph\u00ed<span style=\"font-weight: 400;\">: Ch\u1ec9 t\u00ednh ph\u00ed d\u1ef1a tr\u00ean t\u00e0i nguy\u00ean s\u1eed d\u1ee5ng, kh\u00f4ng c\u1ea7n duy tr\u00ec m\u00e1y ch\u1ee7 ri\u00eang.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">Qu\u1ea3n l\u00fd d\u1ec5 d\u00e0ng<span style=\"font-weight: 400;\">: Kh\u00f4ng c\u1ea7n qu\u1ea3n l\u00fd c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng, t\u1eadp trung v\u00e0o logic nghi\u1ec7p v\u1ee5.<\/span><\/li>\n<\/ul>\n<p><b>T\u00f3m l\u1ea1i<\/b><\/p>\n<p><span style=\"font-weight: 400;\">T\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase kh\u00f4ng ch\u1ec9 gi\u00fap c\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t, b\u1ea3o m\u1eadt m\u00e0 c\u00f2n gi\u00fap \u1ee9ng d\u1ee5ng d\u1ec5 d\u00e0ng m\u1edf r\u1ed9ng m\u00e0 kh\u00f4ng g\u1eb7p tr\u1edf ng\u1ea1i v\u1ec1 h\u1ea1 t\u1ea7ng. B\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng <\/span><b>Firebase Performance Monitoring<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 theo d\u00f5i v\u00e0 c\u1ea3i thi\u1ec7n hi\u1ec7u su\u1ea5t, <\/span><b>Firebase Security Rules<\/b><span style=\"font-weight: 400;\"> v\u00e0 <\/span><b>Authentication<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 b\u1ea3o v\u1ec7 d\u1eef li\u1ec7u, c\u00f9ng v\u1edbi <\/span><b>Firebase Cloud Functions<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 m\u1edf r\u1ed9ng kh\u1ea3 n\u0103ng backend, b\u1ea1n c\u00f3 th\u1ec3 ph\u00e1t tri\u1ec3n v\u00e0 duy tr\u00ec m\u1ed9t \u1ee9ng d\u1ee5ng nhanh, an to\u00e0n v\u00e0 d\u1ec5 d\u00e0ng m\u1edf r\u1ed9ng khi nhu c\u1ea7u t\u0103ng cao.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Firebase l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng m\u1ea1nh m\u1ebd cung c\u1ea5p t\u1ea5t c\u1ea3 c\u00e1c c\u00f4ng c\u1ee5 c\u1ea7n thi\u1ebft \u0111\u1ec3 t\u1ed1i \u01b0u h\u00f3a \u1ee9ng d\u1ee5ng, gi\u00fap c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n t\u1eadp trung h\u01a1n v\u00e0o vi\u1ec7c t\u1ea1o ra tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng xu\u1ea5t s\u1eafc.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_React_Native_Firebase\"><\/span><strong>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 React Native Firebase<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><strong>Firebase Authentication h\u1ed7 tr\u1ee3 nh\u1eefng ph\u01b0\u01a1ng th\u1ee9c x\u00e1c th\u1ef1c n\u00e0o?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Firebase Authentication h\u1ed7 tr\u1ee3 nhi\u1ec1u ph\u01b0\u01a1ng th\u1ee9c x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng, bao g\u1ed3m:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Email\/Password<\/b><span style=\"font-weight: 400;\">: \u0110\u0103ng k\u00fd v\u00e0 \u0111\u0103ng nh\u1eadp b\u1eb1ng email v\u00e0 m\u1eadt kh\u1ea9u.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Google, Facebook, Twitter, GitHub<\/b><span style=\"font-weight: 400;\">: X\u00e1c th\u1ef1c qua c\u00e1c m\u1ea1ng x\u00e3 h\u1ed9i.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Phone Authentication<\/b><span style=\"font-weight: 400;\">: X\u00e1c th\u1ef1c qua s\u1ed1 \u0111i\u1ec7n tho\u1ea1i v\u1edbi OTP (One Time Password).<\/span><\/li>\n<\/ul>\n<h3><strong>L\u00e0m c\u00e1ch n\u00e0o \u0111\u1ec3 b\u1ea3o m\u1eadt d\u1eef li\u1ec7u khi s\u1eed d\u1ee5ng Firebase?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Firebase cung c\u1ea5p c\u00e1c c\u00f4ng c\u1ee5 m\u1ea1nh m\u1ebd \u0111\u1ec3 b\u1ea3o v\u1ec7 d\u1eef li\u1ec7u c\u1ee7a b\u1ea1n:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Firebase Authentication<\/b><span style=\"font-weight: 400;\">: X\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o ch\u1ec9 nh\u1eefng ng\u01b0\u1eddi c\u00f3 quy\u1ec1n m\u1edbi c\u00f3 th\u1ec3 truy c\u1eadp \u1ee9ng d\u1ee5ng.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Firebase Security Rules<\/b><span style=\"font-weight: 400;\">: \u0110\u1eb7t c\u00e1c quy t\u1eafc b\u1ea3o m\u1eadt cho Cloud Firestore v\u00e0 Firebase Storage \u0111\u1ec3 ki\u1ec3m so\u00e1t quy\u1ec1n \u0111\u1ecdc\/ghi d\u1eef li\u1ec7u d\u1ef1a tr\u00ean quy\u1ec1n c\u1ee7a ng\u01b0\u1eddi d\u00f9ng.<\/span><\/li>\n<\/ul>\n<h3><strong>Firebase c\u00f3 h\u1ed7 tr\u1ee3 serverless kh\u00f4ng?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">C\u00f3, <\/span><b>Firebase Cloud Functions<\/b><span style=\"font-weight: 400;\"> l\u00e0 d\u1ecbch v\u1ee5 serverless c\u1ee7a Firebase, cho ph\u00e9p b\u1ea1n vi\u1ebft v\u00e0 tri\u1ec3n khai c\u00e1c h\u00e0m x\u1eed l\u00fd logic backend m\u00e0 kh\u00f4ng c\u1ea7n ph\u1ea3i qu\u1ea3n l\u00fd m\u00e1y ch\u1ee7. Firebase s\u1ebd t\u1ef1 \u0111\u1ed9ng m\u1edf r\u1ed9ng v\u00e0 ch\u1ea1y c\u00e1c h\u00e0m khi c\u1ea7n thi\u1ebft.<\/span><\/p>\n<h3><strong>Firebase c\u00f3 t\u00ednh ph\u00ed kh\u00f4ng?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Firebase cung c\u1ea5p c\u00e1c d\u1ecbch v\u1ee5 mi\u1ec5n ph\u00ed v\u1edbi <\/span><b>g\u00f3i Spark<\/b><span style=\"font-weight: 400;\"> cho c\u00e1c d\u1ef1 \u00e1n nh\u1ecf ho\u1eb7c c\u00e1 nh\u00e2n. Tuy nhi\u00ean, n\u1ebfu \u1ee9ng d\u1ee5ng c\u1ee7a b\u1ea1n ph\u00e1t tri\u1ec3n v\u1edbi l\u01b0\u1ee3ng ng\u01b0\u1eddi d\u00f9ng v\u00e0 t\u00e0i nguy\u00ean l\u1edbn, b\u1ea1n s\u1ebd c\u1ea7n n\u00e2ng c\u1ea5p l\u00ean c\u00e1c g\u00f3i tr\u1ea3 ph\u00ed nh\u01b0 <\/span><b>Blaze<\/b><span style=\"font-weight: 400;\">, t\u00ednh ph\u00ed d\u1ef1a tr\u00ean l\u01b0\u1ee3ng s\u1eed d\u1ee5ng t\u00e0i nguy\u00ean (pay-as-you-go).<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Tong_ket_React_Native_Firebase\"><\/span><strong>T\u1ed5ng k\u1ebft React Native Firebase<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Firebase l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng to\u00e0n di\u1ec7n, cung c\u1ea5p h\u00e0ng lo\u1ea1t c\u00e1c t\u00ednh n\u0103ng m\u1ea1nh m\u1ebd gi\u00fap t\u1ed1i \u01b0u h\u00f3a v\u00e0 m\u1edf r\u1ed9ng \u1ee9ng d\u1ee5ng React Native m\u1ed9t c\u00e1ch d\u1ec5 d\u00e0ng. Vi\u1ec7c t\u00edch h\u1ee3p Firebase v\u1edbi React Native mang l\u1ea1i nhi\u1ec1u l\u1ee3i \u00edch v\u01b0\u1ee3t tr\u1ed9i, t\u1eeb kh\u1ea3 n\u0103ng x\u00e1c th\u1ef1c ng\u01b0\u1eddi d\u00f9ng, qu\u1ea3n l\u00fd c\u01a1 s\u1edf d\u1eef li\u1ec7u, th\u00f4ng b\u00e1o \u0111\u1ea9y, cho \u0111\u1ebfn c\u00e1c t\u00ednh n\u0103ng serverless gi\u00fap b\u1ea1n qu\u1ea3n l\u00fd backend m\u00e0 kh\u00f4ng c\u1ea7n ph\u1ea3i lo l\u1eafng v\u1ec1 c\u01a1 s\u1edf h\u1ea1 t\u1ea7ng.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">V\u1edbi s\u1ef1 h\u1ed7 tr\u1ee3 m\u1ea1nh m\u1ebd t\u1eeb c\u00e1c d\u1ecbch v\u1ee5 nh\u01b0 <\/span><b>Firebase Authentication<\/b><span style=\"font-weight: 400;\">, <\/span><b>Cloud Firestore<\/b><span style=\"font-weight: 400;\">, <\/span><b>Firebase Cloud Messaging<\/b><span style=\"font-weight: 400;\">, v\u00e0 <\/span><b>Cloud Functions<\/b><span style=\"font-weight: 400;\">, c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n c\u00f3 th\u1ec3 x\u00e2y d\u1ef1ng nh\u1eefng \u1ee9ng d\u1ee5ng \u0111a n\u1ec1n t\u1ea3ng m\u1ed9t c\u00e1ch nhanh ch\u00f3ng v\u00e0 hi\u1ec7u qu\u1ea3. Ngo\u00e0i ra, vi\u1ec7c b\u1ea3o m\u1eadt d\u1eef li\u1ec7u ng\u01b0\u1eddi d\u00f9ng c\u0169ng \u0111\u01b0\u1ee3c Firebase t\u1ed1i \u01b0u th\u00f4ng qua <\/span><b>Security Rules<\/b><span style=\"font-weight: 400;\"> v\u00e0 c\u01a1 ch\u1ebf x\u00e1c th\u1ef1c m\u1ea1nh m\u1ebd, gi\u00fap b\u1ea1n y\u00ean t\u00e2m h\u01a1n v\u1ec1 vi\u1ec7c b\u1ea3o v\u1ec7 d\u1eef li\u1ec7u.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c k\u1ebft h\u1ee3p Firebase trong ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng React Native kh\u00f4ng ch\u1ec9 gi\u00fap t\u0103ng t\u1ed1c qu\u00e1 tr\u00ecnh ph\u00e1t tri\u1ec3n m\u00e0 c\u00f2n mang l\u1ea1i tr\u1ea3i nghi\u1ec7m ng\u01b0\u1eddi d\u00f9ng t\u1ed1t h\u01a1n nh\u1edd v\u00e0o c\u00e1c c\u00f4ng c\u1ee5 gi\u00e1m s\u00e1t hi\u1ec7u su\u1ea5t v\u00e0 t\u00ednh n\u0103ng m\u1edf r\u1ed9ng linh ho\u1ea1t.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>React Native Firebase l\u00e0 m\u1ed9t gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd cho ph\u00e9p c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n k\u1ebft h\u1ee3p s\u1ee9c m\u1ea1nh c\u1ee7a n\u1ec1n t\u1ea3ng ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng \u0111a n\u1ec1n t\u1ea3ng React Native v\u1edbi c\u00e1c d\u1ecbch v\u1ee5 \u0111a d\u1ea1ng v\u00e0 linh ho\u1ea1t c\u1ee7a Firebase. S\u1ef1 t\u00edch h\u1ee3p n\u00e0y gi\u00fap t\u1ed1i \u01b0u h\u00f3a qu\u00e1 tr\u00ecnh x\u00e2y d\u1ef1ng c\u00e1c [&hellip;]<\/p>\n","protected":false},"author":203,"featured_media":79557,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-79378","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase - ITviec Blog<\/title>\n<meta name=\"description\" content=\"React Native Firebase l\u00e0 gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd k\u1ebft h\u1ee3p gi\u1eefa React Native v\u00e0 Firebase. Hi\u1ec3u r\u00f5 c\u00e1ch c\u1ea5u h\u00ecnh v\u00e0 s\u1eed d\u1ee5ng Firebase qua React Native.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase\" \/>\n<meta property=\"og:description\" content=\"React Native Firebase l\u00e0 m\u1ed9t gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd cho ph\u00e9p c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n k\u1ebft h\u1ee3p s\u1ee9c m\u1ea1nh c\u1ee7a n\u1ec1n t\u1ea3ng ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng \u0111a n\u1ec1n t\u1ea3ng React Native v\u1edbi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-30T16:04:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/09\/React-Native-Firebase-thumbnail-vippro.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1500\" \/>\n\t<meta property=\"og:image:height\" content=\"790\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tien Tran\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tien Tran\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"22 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase - ITviec Blog","description":"React Native Firebase l\u00e0 gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd k\u1ebft h\u1ee3p gi\u1eefa React Native v\u00e0 Firebase. Hi\u1ec3u r\u00f5 c\u00e1ch c\u1ea5u h\u00ecnh v\u00e0 s\u1eed d\u1ee5ng Firebase qua React Native.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/","og_locale":"vi_VN","og_type":"article","og_title":"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase","og_description":"React Native Firebase l\u00e0 m\u1ed9t gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd cho ph\u00e9p c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n k\u1ebft h\u1ee3p s\u1ee9c m\u1ea1nh c\u1ee7a n\u1ec1n t\u1ea3ng ph\u00e1t tri\u1ec3n \u1ee9ng d\u1ee5ng \u0111a n\u1ec1n t\u1ea3ng React Native v\u1edbi","og_url":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2024-09-30T16:04:05+00:00","og_image":[{"width":1500,"height":790,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/09\/React-Native-Firebase-thumbnail-vippro.jpg","type":"image\/jpeg"}],"author":"Tien Tran","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Tien Tran","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"22 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/"},"author":{"name":"Tien Tran","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/1595d671c49cfa2a48cd3c0a047a1298"},"headline":"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase","datePublished":"2024-09-30T16:04:05+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/"},"wordCount":5952,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/09\/React-Native-Firebase-thumbnail-vippro.jpg","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/","url":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/","name":"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/09\/React-Native-Firebase-thumbnail-vippro.jpg","datePublished":"2024-09-30T16:04:05+00:00","description":"React Native Firebase l\u00e0 gi\u1ea3i ph\u00e1p m\u1ea1nh m\u1ebd k\u1ebft h\u1ee3p gi\u1eefa React Native v\u00e0 Firebase. Hi\u1ec3u r\u00f5 c\u00e1ch c\u1ea5u h\u00ecnh v\u00e0 s\u1eed d\u1ee5ng Firebase qua React Native.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/09\/React-Native-Firebase-thumbnail-vippro.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/09\/React-Native-Firebase-thumbnail-vippro.jpg","width":1500,"height":790,"caption":"React Native Firebase - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/react-native-firebase-la-gi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"React Native Firebase: T\u1ed1i \u01b0u \u1ee9ng d\u1ee5ng React Native v\u1edbi Firebase"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/1595d671c49cfa2a48cd3c0a047a1298","name":"Tien Tran","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/05\/tien-tran-author-e1715658627643-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/05\/tien-tran-author-e1715658627643-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/05\/tien-tran-author-e1715658627643-100x100.jpg","caption":"Tien Tran"},"url":"https:\/\/itviec.com\/blog\/author\/tien-tran\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/79378","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/203"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=79378"}],"version-history":[{"count":0,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/79378\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/79557"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=79378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=79378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=79378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}