Skip to content

Instantly share code, notes, and snippets.

View dialguiba's full-sized avatar
🎯
_Focusing

Diego dialguiba

🎯
_Focusing
View GitHub Profile
@dialguiba
dialguiba / lazy.jsx
Created February 15, 2022 20:21
Lazy
const Loader = React.lazy(() => import("react-loader-spinner").then((module) => ({ default: module[spinner] })));
const Loader = React.lazy(() => import(`react-spinners/${test}`));
@dialguiba
dialguiba / AppRouter.js
Last active February 6, 2022 22:12
routes-v6
import { useEffect, useState } from "react";
import { BrowserRouter as Router, Redirect, Route, Navigate, BrowserRouter, Routes } from "react-router-dom";
import { useDispatch } from "react-redux";
import { AuthRouter } from "./AuthRouter";
/* import { firebase } from "../firebase/firebase-config"; */
/* import { login } from "../actions/Auth"; */
import { PrivateRoute } from "./PrivateRoute";
import { PublicRoute } from "./PublicRoute";
/* import { startLoadingNotes } from "../actions/notes"; */
@dialguiba
dialguiba / AppRouter.js
Last active February 6, 2022 20:11
routes
import { useEffect, useState } from "react";
import { BrowserRouter as Router, Switch, Redirect } from "react-router-dom";
import { useDispatch } from "react-redux";
import { JournalScreen } from "../components/journal/JournalScreen";
import { AuthRouter } from "./AuthRouter";
import { firebase } from "../firebase/firebase-config";
import { login } from "../actions/Auth";
import { PrivateRoute } from "./PrivateRoute";
import { PublicRoute } from "./PublicRoute";
@dialguiba
dialguiba / ghpages.yml
Last active February 6, 2022 23:13
gh-actions
name: Build and Deploy
on: [push]
env:
REACT_APP_API_URL: ${{secrets.REACT_APP_API_URL}}
jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
environment: github-pages
steps:
@dialguiba
dialguiba / index.js
Last active February 5, 2022 05:29
react-store-persistent
import React from "react";
import ReactDOM from "react-dom";
import { TodoApp } from "./TodoApp";
import { store, persistor } from "./store/store";
import { Provider } from "react-redux";
/* */
import { PersistGate } from "redux-persist/integration/react";
import { HashRouter } from "react-router-dom";
@dialguiba
dialguiba / readme.md
Last active February 11, 2022 14:36
react-hooks

Custom Hook: UseForm

Use:

const [formTodoValues, handleTodoInputChange] = useForm({
    name: "",
    date: moment(new Date()).format("YYYY-MM-DD"),
    description: "",
 });
@dialguiba
dialguiba / app.js
Last active February 5, 2022 05:29
react-store
import { Provider } from "react-redux";
import { AppRouter } from "./router/AppRouter";
import { store } from "./store/store";
export const CalendarApp = () => {
return (
<Provider store={store}>
<AppRouter />
</Provider>
);