• This repository has been archived on 26/Jan/2021
  • Stars
    star
    1,295
  • Rank 35,472 (Top 0.8 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 9 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Seamlessly bring Parse data into your React applications.

WARNING ⚠️ - this project is not maintained, if you wish to maintain this project make yourself known ⚠️

Parse + React

Seamlessly bringing Parse data into your React applications.

NOTE: Parse + React only supports the Parse JS SDK up to version 1.6.14. Behavior with 1.7.* is unpredictable, and 1.8.* breaks functionality with the new LiveQueries feature. As developers, we want to encourage patterns that integrate easily into both the server and the client, and are working on a new low-level SDK that works well with Redux and React Native. When that codebase is ready for production apps, we will publish a new recommended starter kit for apps built on Parse & React.

Build Status npm version

Overview

Parse + React is an interface layer on top of the Parse JS SDK that provides simple access to the Parse API from React. It lets React components subscribe to Parse queries, and allows data mutations to be dispatched in a Flux-style manner. In the background, these subscriptions are managed in a way that lets these components automatically update as objects are created and modified, allowing user interfaces to be snappy and responsive.

Full API

Example

To add Parse data to a component, it simply needs to subscribe to a standard Parse Query. This is done through an implementation of the newly-proposed observe() API for React. The ParseReact Mixin allows a version of this new lifecycle method to be used today with Parse Queries.

If you're using React with ES6 classes, we also provide a subclass of React.Component that allows you to use the observe() and Query-specific APIs.

var CommentBlock = React.createClass({
  mixins: [ParseReact.Mixin], // Enable query subscriptions

  observe: function() {
    // Subscribe to all Comment objects, ordered by creation date
    // The results will be available at this.data.comments
    return {
      comments: (new Parse.Query('Comment')).ascending('createdAt')
    };
  },

  render: function() {
    // Render the text of each comment as a list item
    return (
      <ul>
        {this.data.comments.map(function(c) {
          return <li>{c.text}</li>;
        })}
      </ul>
    );
  }
});

Whenever this component mounts, it will issue the query and the results will be attached to this.data.comments. Each time the query is re-issued, or objects are modified locally that match the query, it will update itself to reflect these changes.

Mutations are dispatched in the manner of Flux Actions, allowing updates to be synchronized between many different components without requiring views to talk to each other. All of the standard Parse data mutations are supported, and you can read more about them in the Data Mutation guide.

// Create a new Comment object with some initial data
ParseReact.Mutation.Create('Comment', {
  text: 'Parse <3 React'
}).dispatch();

Getting Started

Parse + React is available from our CDN (minified), and npm.

If you're not familiar with React, we recommend you first walk through their tutorials before adding Parse data to your React applications.

Parse + React adds new functionality when React and the Parse JS SDK are used together, and it requires that those libraries be in place before it is initialized. The easiest way to do this is to load them on your page before loading the Parse + React library:

<html>
  <head>
    <script src="http://fb.me/react-0.13.3.min.js"></script>
    <script src="https://www.parsecdn.com/js/parse-latest.js"></script>
    <!-- Now include parse-react.js -->
    <script src="https://www.parsecdn.com/js/parse-react.js"></script>

    ...

If you're using a tool like Webpack or Browserify to enable Common JS require statements, you need to make sure you also include the 'parse' npm package in your dependencies.

var React = require('react');
var Parse = require('parse');
var ParseReact = require('parse-react');

// ...

As of version 1.6, the Parse JS SDK has a different build for React Native. If you're using Parse+React on React Native, you'll need to require the 'parse-react/react-native' package instead.

// For React Native apps
var React = require('react-native');
var Parse = require('parse/react-native');
var ParseReact = require('parse-react/react-native');

Now that you've included all of the necessary libraries, you're ready to start subscribing to Parse data and mutating it.

Contributing

See the CONTRIBUTING file for information on how to help out.

More Repositories

1

parse-server

Parse Server for Node.js / Express
JavaScript
20,674
star
2

parse-dashboard

A dashboard for managing Parse Server
JavaScript
3,728
star
3

Parse-SDK-iOS-OSX

The Apple SDK for Parse Platform (iOS, macOS, watchOS, tvOS)
Objective-C
2,803
star
4

parse-server-example

Example of Parse Server using the express framework.
JavaScript
1,879
star
5

Parse-SDK-Android

The Android SDK for Parse Platform
Java
1,878
star
6

Parse-SDK-JS

The JavaScript SDK for Parse Platform
JavaScript
1,311
star
7

ParseUI-iOS

A collection of a handy user interface components to be used with the Parse iOS SDK.
Objective-C
935
star
8

parse-php-sdk

The PHP SDK for Parse Platform
PHP
812
star
9

ParseUI-Android

ParseUI contains user interface libraries for building apps with the Parse Android SDK.
Java
592
star
10

Parse-SDK-Flutter

The Dart/Flutter SDK for Parse Platform
Dart
568
star
11

Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
C#
321
star
12

docs

Parse Platform docs
SCSS
314
star
13

Parse-Swift

The Swift SDK for Parse Platform (iOS, macOS, watchOS, tvOS, Linux, Android, Windows)
Swift
299
star
14

parse-embedded-sdks

The Embedded SDKs for the Parse Platform
C
246
star
15

ParseLiveQuery-iOS-OSX

Parse LiveQuery Client for iOS/OS X.
Swift
192
star
16

parse-cli

Go
118
star
17

ParseFacebookUtils-iOS

A set of utilities to integrate Facebook with the Parse iOS/tvOS SDK.
Objective-C
92
star
18

parse-server-push-adapter

A push notification adapter for Parse Server
JavaScript
84
star
19

parse-server-simple-mailgun-adapter

Used to send Parse Server password reset and email verification emails though Mailgun
JavaScript
84
star
20

ParseLiveQuery-Android

Parse LiveQuery client for Android.
Java
84
star
21

parse-server-s3-adapter

AWS S3 file storage adapter for Parse Server
JavaScript
76
star
22

parse-react

[EXPERIMENTAL] React, React Native, and React with SSR (e.g. Next.js) packages to interact with Parse Server backend
TypeScript
70
star
23

Parse-SDK-Arduino

The Arduino SDK for the Parse Platform
C++
67
star
24

ParseFacebookUtils-Android

A utility library to authenticate ParseUsers with the Facebook SDK
Java
53
star
25

ParseTwitterUtils-iOS

A set of utilities to integrate Twitter with the Parse iOS SDK.
Objective-C
46
star
26

parse-server-fs-adapter

parse-server file system storage adapter
JavaScript
42
star
27

ParseInterceptors-Android

Parse Network Interceptor Debugging
Java
37
star
28

ParseTwitterUtils-Android

A utility library to authenticate ParseUsers with Twitter
Java
36
star
29

parse-blockchain

Blockchain (Ethereum) dApps development made easy with Parse Server (alpha)
TypeScript
36
star
30

parse-facebook-user-session

A Cloud Code module to facilitate logging into an express website with Facebook.
JavaScript
36
star
31

parse-server-gcs-adapter

parse-server adapter for Google Cloud Storage
JavaScript
29
star
32

parse-server-api-mail-adapter

API Mail Adapter for Parse Server
JavaScript
25
star
33

benchmark

Parse Server Continuous Benchmark
JavaScript
24
star
34

xctoolchain-archive

Common configuration files and scripts that are used to build our SDKs with Xcode.
Ruby
22
star
35

blog

Parse Community Blog
SCSS
18
star
36

parse-server-sqs-mq-adapter

Spread work queue accross cluster of parse servers using SQS
JavaScript
17
star
37

parse-community.github.io

Parse Platform GitHub Pages
SCSS
10
star
38

relay-examples

Parse-Server GraphQL Relay Todo
JavaScript
10
star
39

Governance

Details about the leadership & decision making process for the Parse Community
10
star
40

parse-server-conformance-tests

Conformance tests for parse-server adapters
JavaScript
7
star
41

parse-community-peril

Peril for the parse-community
TypeScript
6
star
42

.github

Default community health files for the Parse Community
4
star
43

release-automation-playground

A playground repo to experiment with release automation.
2
star
44

docs-tutorial-todoapp

A tutorial for developing a ToDo app with Parse Platform
1
star