Skip to content

Instantly share code, notes, and snippets.

View gnppro's full-sized avatar
🇲🇽

Gerardo Nava Pereda gnppro

🇲🇽
View GitHub Profile
@gnppro
gnppro / Redux-Example-Bedu.js
Last active June 28, 2019 20:47
Para usar la data de API por GET axios
import axios from 'axios'
const ADD_TOKEN = 'ADD_TOKEN';
const ITEMS = 'ITEMS';
export const addToken = (token) => ({ type: ADD_TOKEN, payload: token });
export const addDataItems = (data) => ({ type: ITEMS, payload: data });
// export function asyncCallItems(dispatch) {
// return dispatch
//Mac
brew cask install android-sdk
//Windows
choco install android-sdk
//Linux
//Con sudo
$ npm install -g create-react-native-app
# or
$ yarn global add create-react-native-app
yarn global add gatsby-cli
gatsby new gatsby-example https://github.com/gatsbyjs/gatsby-starter-hello-world
cd gatsby-example
yarn add react react-domx
//Deploy
yarn global add surge
o
yarn global add now
=> Windows
@gnppro
gnppro / VSCodeSettings.json
Last active February 2, 2020 22:31
My Config of Visual Studio Code
{
// "sync.gist": "94b54e6671ef3e2d752a40e359a2137a"
"window.zoomLevel": 2,
"workbench.colorTheme": "Night Owl",
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "newUntitledFile",
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"erb": "html"
/***
CREATE input
***/
<input
type="email" placeholder="Email"
value={this.state.email}
onChange={this.handleEmailChange}
required autoFocus
ref="emailTest"
/>
import Layout from '../components/MyLayout.js'
import Link from 'next/link'
// import fetch from 'isomorphic-unfetch'
import axios from 'axios'
const Index = (props) => (
<Layout>
<h1>Batman TV Shows</h1>
<ul>
{props.data.map(({show}) => (
localStorage.setItem('key', value)
axios.post
$.post("/authenticate", {email: userEmail, password: userPassword}, function(data) {
localStorage.setItem('token', data.token)
});
localStorage.getItem('key')
Ajax example:
import React, { Component } from 'react';
import './App.css';
import List from './List';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
term: '',
items: []
import React from 'react';
import axios from 'axios';
class Form extends React.Component {
state = {
name: '',
email: '',
message: '',
};
const addMessage = message => {
return {
type: "ADD",
message: message
};
};
const mapStateToProps = state => {
return {
messages: state