Skip to content

Instantly share code, notes, and snippets.

View NavizDev's full-sized avatar
😀
Happy

Juan Silupu Maza NavizDev

😀
Happy
View GitHub Profile
@NavizDev
NavizDev / useAuthFirebase.js
Created April 14, 2020 14:30
hook para manejar firebase en toda la app
View useAuthFirebase.js
import React, { useState, useEffect, useContext, createContext } from "react";
import firebase from "firebase/app";
import "firebase/auth";
import firebaseConfig from "../firebase/firebaseConfig";
if (firebase.apps.length === 0) {
firebase.initializeApp(firebaseConfig);
}
const authContext = createContext();
View useForm.js
import { useState, useEffect } from "react";
const useForm = ({ initialValues }) => {
console.log(initialValues);
const [fields, setFields] = useState(initialValues);
const onChange = event => {
const { value, name } = event.target;
setFields({ ...fields, [name]: value });
@NavizDev
NavizDev / ListSedes.js
Last active December 14, 2019 01:54
Lista de Sedes y Subsedes. Cada Sede tiene subsedes, y esta sede le pertenece a un Cliente.
View ListSedes.js
import React from 'react';
import { Collapse, Icon, Select } from 'antd';
import { Form, Input, Button, message } from 'antd';
import AddItemInput from './AddItemInput'
import ListSubStation from './ListSubStation'
import SaveLocationForm from './SaveLocationForm'
import ClientService from '../../../clientService'
const { Panel } = Collapse;
@NavizDev
NavizDev / index.html
Created October 10, 2019 05:16
Ng-Change vs $watch
View index.html
<html> <div ng-app="myApp" ng-controller="myController">
<h3>DATOS DE LA PERSONA:<h3>
<input ng-model="person.name"></input>
<select id="typeperson" ng-model="person.typeperson" ng-change="changetypedocument()">
<option ng-repeat="item in typeperson" value="{{item.id}}">{{item.name}}</option>
</select>
<select name="typedocument" id="typedocument" ng-model="person.typedocument" >
<option ng-repeat="item in typedocument" value="{{item.id}}">{{item.name}}
</select>
<button ng-click="load()">Cargar</button>