Skip to content
NCMB SDK for React Native
TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
libs
.DS_Store
.gitignore
LICENSE
README.md
index.ts
package.json

README.md

React Native SDK for NCMB(ニフクラ mobile backend)

ニフクラ mobile backendをReact Nativeから操作するためのSDKです。詳細な使い方はブログでもご覧いただけます。

インストール

npm i ncmb-react-native -S

使い方

読み込み

import NCMB from 'ncmb-react-native';

初期化

import config from './config.json';
const ncmb = new NCMB(config.applicationKey, config.clientKey);

データ保存

const Hello = ncmb.DataStore('Hello');
const hello = new Hello();
try {
  await hello
    .set('message', 'Hello world')
    .save();
  console.log(hello.get('createDate'));
} catch (e) {
  console.log(e);
}

ロールの作成

let role = await ncmb.Role.equalTo('roleName', 'Admin').fetch();
if (!role) {
  role = new ncmb.Role();
  await role
    .set('roleName', 'Admin')
    .addUser(user)
    .save();
}
You can’t perform that action at this time.