npm install firebase
npm install ra-data-firebase-client
import { Admin, Resource } from 'react-admin'
import firebaseDataProvider from 'ra-data-firebase-client'
import firebase from 'firebase/app'
import "firebase/database";
firebase.initializeApp({
apiKey: '**************',
authDomain: '**************',
databaseURL: 'https://myrealtimedatabase.firebaseio.com',
projectId: 'myrealtimedatabase',
storageBucket: 'myrealtimedatabase.appspot.com',
messagingSenderId: '**************',
appId: '**************',,
measurementId: '**************'
})
const settings = {context: 'dev', imagekey: "images", filekey: "files"}
export default () =>
<Admin dataProvider={firebaseDataProvider(firebase, settings)}>
<Resource
name='posts'
list={PostList}
edit={PostEdit}
create={PostCreate} />
</Admin>
{
"myrealtimedatabase": {
"dev" : {
"posts" : {
"-M6rfMORj0dfoisK1taJ" : {
"id" : "-M6rfMORj0dfoisK1taJ",
"key1" : "value1",
"key2" : "value2",
"images": [
{
"id": "-M6rfMORj0dfoisK1taJ_img_0"},
"src": "data:image/jpeg;base64......",
"size": 150402,
"title": "my-uploaded-image.jpg"
"type": "image"
{...},
{...}
]
"files": [
{
"id": "-M6rfMORj0dfoisK1taJ_img_0"},
"src": "data:application/pdf;base64......",
"size": 150402,
"title": "my-uploaded-file.pdf"
"type": "file"
{...},
{...}, {...}, {...}]
}
}
}
}
}
https://aymendhaya.github.io/ra-data-firebase-client
Firebase authProvider on versions < 3 has been moved to a separate project ra-auth-firebase-client