Skip to content

Instantly share code, notes, and snippets.

View jsoneaday's full-sized avatar

jsoneaday

View GitHub Profile
Verifying my Blockstack ID is secured with the address 12V3dWzQSkHFePfDGzY5mZKD9RX3uxvT5d https://explorer.blockstack.org/address/12V3dWzQSkHFePfDGzY5mZKD9RX3uxvT5d
import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
import App from "./App";
import configureStore from "./shared/store/configureStore";
import registerServiceWorker from "./registerServiceWorker";
import { Provider } from "react-redux";
import ErrorBoundary from "./shared/components/ErrorBoundary";
import Modal from "react-modal";
import ApolloClient, { InMemoryCache } from "apollo-boost";
@jsoneaday
jsoneaday / useLazyQuery.tsx
Last active December 2, 2019 18:23
show usage of useLazyQuery
const [
execGetThreadData,
{ called, data: getThreadData, error, loading, refetch }
] = useLazyQuery(GetThread);
useEffect(() => {
if (called && loading) {
log("thread is loading");
} else if (error) {
log(error);
@jsoneaday
jsoneaday / useMutation.tsx
Created December 2, 2019 18:25
useMutation demo
const [execPostThread] = useMutation<any, any>(PostThreadMutation, {
refetchQueries: [
{
query: QueryMe
}
]
});
useEffect(() => {
if (askToPostThread && allowPostThread) {
const { data, errors } = await execPostThread({
variables: {
threadId: localThread !== null ? localThread.id : "0",
userId: userProfile ? userProfile!.id : "0",
title,
body,
videoUrl,
bounty,
categoryId: selectedCategory!.id
}
import React from 'react';
import { Redirect, Route } from 'react-router-dom';
import {
IonApp,
IonIcon,
IonLabel,
IonRouterOutlet,
IonTabBar,
IonTabButton,
IonTabs
import {
IonCard,
IonCardContent,
IonCardHeader,
IonCardSubtitle,
IonCardTitle,
IonContent,
IonHeader,
IonIcon,
IonItem,
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { defineCustomElements } from '@ionic/pwa-elements/loader';
ReactDOM.render(<App />, document.getElementById('root'));
defineCustomElements(window);
import React from 'react';
import { Redirect, Route } from 'react-router-dom';
import {
IonApp,
IonIcon,
IonLabel,
IonRouterOutlet,
IonTabBar,
IonTabButton,
IonTabs
import React, { useCallback, useEffect } from 'react';
import { CameraResultType } from '@capacitor/core';
import { useCamera, availableFeatures } from '@ionic/react-hooks/camera';
import { IonButton, IonContent, IonHeader, IonToolbar, IonTitle, IonPage, IonText } from '@ionic/react';
const Camera: React.FC = () => {
const { photo, getPhoto } = useCamera();
const triggerCamera = useCallback(async () => {
if(availableFeatures.getPhoto) {
await getPhoto({