Skip to content

Instantly share code, notes, and snippets.

View alejovdev's full-sized avatar
💻
Coding

Alejov alejovdev

💻
Coding
View GitHub Profile
@alejovdev
alejovdev / App.js
Last active November 26, 2019 02:43
import React, { useState, useEffect } from "react";
import { BrowserRouter, Switch, Route, Link } from "react-router-dom";
function Config({}) {
return (
<div className="config">
<h1>Config</h1>
<Link to="/">Todos</Link>
</div>
);
import React, { useState, useEffect } from "react";
import { BrowserRouter, Switch, Route, Link } from "react-router-dom";
// Import Helmet
import Helmet from "react-helmet";
function Config({}) {
return (
<div className="config">
{/* Add a Helmet tag with the title tag inside */}
function Todos({}) {
// Create the state
const [_todos, setTodos] = useState(0);
return (
<div className="todos">
<Helmet>
{/* Display the state as string */}
<title>MyApp | Todos {_todos.toString()}</title>
<Helmet>
<meta name="description" content="Lorem ipsum" />
<meta
name="robots"
content="max-snippet:-1, max-image-preview:large, max-video-preview:-1"
/>
<link rel="canonical" href="https://yourapp.com" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your App | Config" />
import React, { useState } from 'react'
import './App.css'
function App() {
const [views, setViews] = useState(0)
return (
<div>
<h1>Live counter</h1>
<h2>{views}</h2>
import firebase from 'firebase/app'
import 'firebase/firestore'
const firebaseConfig = {
// THE CONFIG OBJECT OF YOUR FIREBASE PROJECT
// YOU CAN GET THIS AT THE FIREBASE DASHBOARD
// https://firebase.google.com/docs/web/setup
}
firebase.initializeApp(firebaseConfig)
import React, { useState, useEffect } from "react";
import { firestore } from "./firebase";
function App() {
const [title, setTitle] = useState(null);
const [lang, setLang] = useState("en");
useEffect(() => getTitle(), []);
const getTitle = async () => {
exports.uploadExpoImage = functions.https.onCall(
async ({ data_url, path }, context) => {
try {
let base64EncodedImageString = `${data_url}`.replace(
'data:image/png;base64,',
''
)
let mimeType = 'image/png'
let imageBuffer = new Buffer(base64EncodedImageString, 'base64')
let bucket = admin.storage().bucket()
const pickImage = async () => {
let result = await ImagePicker.launchCameraAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [1, 1],
quality: 1,
base64: true
})
if (!result.cancelled){
// I'm adding the data:image, if you want to use the image locally before uploading, you can use a state hook first
<script>
export let dark;
function handleToggle() {
dark = !dark;
}
</script>
<style>
.container {