Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[outdated] Consolidation Providers & Hooks #3339

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions examples/web/src/__tests__/providers-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// :snippet-start:use-providers
import React from "react";
import { APP_ID } from "../realm.config.json";
import { AppProvider, UserProvider, RealmProvider, useRealm, useUser } from "@realm/react";

export const AppWrapper = () => {
return (
<AppProvider id={APP_ID}> {/* pass in your App ID as a prop */}
<UserProvider>
<RealmProvider>
{/* call any app components here */}
</RealmProvider>
</UserProvider>
</AppProvider>
);
};
// :snippet-end:

// export const TestComponent = () => {
// const user = useUser(); // hooks called at top level of a component declaration

// return (
// <Text>user?.id</Text>
// );
// };
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import { APP_ID } from "../realm.config.json";
import { AppProvider, UserProvider, RealmProvider, useRealm, useUser } from "@realm/react";

export const AppWrapper = () => {
return (
<AppProvider id={APP_ID}> {/* pass in your App ID as a prop */}
<UserProvider>
<RealmProvider>
{/* call any app components here */}
</RealmProvider>
</UserProvider>
</AppProvider>
);
};
12 changes: 7 additions & 5 deletions source/frameworks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ Build with Frameworks
.. toctree::
:titlesonly:

React </frameworks/react>
React Native </frameworks/react-native>
Next.js </frameworks/nextjs>
Electron </frameworks/electron>
Flutter </frameworks/flutter>
Maui </frameworks/maui>
.NET </frameworks/dotnet>
React Native </frameworks/react-native>
SwiftUI </frameworks/swiftui>

The following pages contain information about building with specific
frameworks using Atlas Device SDK:

- :ref:`sdks-build-with-react`
- :ref:`sdks-build-with-react-native`
- :ref:`sdks-build-with-nextjs`
- :ref:`sdks-build-with-electron`
- :ref:`sdks-build-with-flutter`
- :ref:`sdks-build-with-maui`
- :ref:`sdks-build-with-dotnet`
- :ref:`sdks-build-with-react-native`
- :ref:`sdks-build-with-swiftui`
- :ref:`sdks-build-with-swiftui`
30 changes: 30 additions & 0 deletions source/frameworks/react.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _sdks-build-with-react:

================
Build with React
================

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

.. toctree::
:titlesonly:

Install </frameworks/react/install>
Quick Start </frameworks/react/quick-start>
Providers & Hooks </frameworks/react/providers-hooks>
Model Data </frameworks/react/model-data>
Open & Manage Database Files </frameworks/react/manage-database-files>
Read & Write Data </frameworks/react/read-write>
React to Changes </frameworks/react/react-to-changes>
Access Atlas </frameworks/react/access-atlas>
Manage Users </frameworks/react/manage-users>
Sync Data </frameworks/react/sync-data>
Test & Debug </frameworks/react/test-debug>
API Reference </frameworks/react/api-reference>

Placeholder page for information about building with React. (This may
be a directory depending on how much content we have/need.)
Loading
Loading