+
diff --git a/documentation/images/Step2.png b/documentation/images/Step2.png new file mode 100644 index 0000000..5efcc6a Binary files /dev/null and b/documentation/images/Step2.png differ diff --git a/documentation/images/Step4Login.png b/documentation/images/Step4Login.png new file mode 100644 index 0000000..18750d2 Binary files /dev/null and b/documentation/images/Step4Login.png differ diff --git a/documentation/images/Step4Logout.png b/documentation/images/Step4Logout.png new file mode 100644 index 0000000..5c91904 Binary files /dev/null and b/documentation/images/Step4Logout.png differ diff --git a/documentation/solid-react-tutorial.md b/documentation/solid-react-tutorial.md new file mode 100644 index 0000000..0c3785c --- /dev/null +++ b/documentation/solid-react-tutorial.md @@ -0,0 +1,240 @@ +# Using LDO to build a Solid Application for React + +Solid separates the application from the storage, allowing users to put their data wherever they choose. Core to achieving this is application interoparability, the ability to use multiple apps on the same dataset. In order to make applications interoperable, Solid is standardized around RDF (Resource Description Framework), a standard for representing data. While RDF is extremely flexible, it is sometimes cumbersome to work with, that's where LDO (Linked Data Objects) comes in. + +In this tutorial, we'll build a web application for Solid using React and LDO. LDO's react library, "@ldobjects/solid-react" is designed to make it easy to manipulate data on a Solid Pod. + +We'll be making a simple micro-blogging website that allows you to write notes and upload photos. + +// TODO insert image + +This tutorial assumes that you are already familiar with React and the overall concepts associated with Solid. + +## 1. Getting Started + +First, we'll initialize the project. LDO is designed to work with TypeScript, so we want to initialize a typescript react project. + +```bash +npx create-react-app my-solid-app --template typescript +cd my-solid-app +``` + +## 2. Setting up a basic app infrastructure + +Before we can use LDO and connect to a Solid Pod, let's get the boilerplace React infrastructure out of the way. We'll set up a single page that renders your blog timeline and lets you make new posts, and we'll do this with 5 components: + +**App.tsx**: Base of the application. +```tsx +import React, { FunctionComponent } from 'react'; +import { Header } from './Header'; +import { Blog } from './Blog'; + +export const App: FunctionComponent = () => { + return ( +
Header
+Post
++ You are logged in with the webId {session.webId}.{" "} + +
+ ) : ( + // If the session is not logged in ++ You are not Logged In{" "} + +
+ )} +No blog available. Log in first.
; + + return ( +Loading...
; } if (mainContainer.isDoingInitialFetch()) { - returnLoading Main Container
; + returnLoading Blob
; } return (No URI Present
} + {uri ?No URI Present
}