Skip to content

Instantly share code, notes, and snippets.

View Salman18's full-sized avatar
👨‍💻
Talk is cheap, show me the code.

Salman Khan Salman18

👨‍💻
Talk is cheap, show me the code.
View GitHub Profile
let breakingBadProimse = fetch("https://www.breakingbadapi.com/api/characters");
breakingBadProimse
.then(function(res){
return res.json();
})
.then(function(res){
console.log(res)
})
.catch(function(error){
console.log(error)
import React from "react";
import styles from "./Login.module.css";
import data from "../../meta/metaData.json";
export default function Login(props) {
const homePageContent = data.login.subContent;
const loginButtons = data.login.buttons;
console.log('isLogged', props.cb)
// onClick={fakeAsyncLogin}
import { BrowserRouter, Routes, Route } from "react-router-dom";
//Pages
import Login from "../pages/login/Login";
import Onboarding from "../onboarding/Onboarding";
import Error from "./Error";
import PrivateRoute from "./Private_Route";
import Dashboard from "../pages/Dashboard";
import { useState } from "react";
import React, { Component } from 'react';
import Icons from 'react-native-vector-icons/Ionicons';
import {
View,
StyleSheet,
BackHandler,
TextInput,
Text,
Dimensions,
TouchableOpacity,
@Salman18
Salman18 / BookedData.js
Created July 11, 2018 18:11
Calling child from parent
import React, { Component } from 'react';
import { View, Text, StyleSheet, Dimensions} from 'react-native';
export default class BookedDate extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.container}>
@Salman18
Salman18 / MultipleReducer.js
Last active December 11, 2017 07:18
I am Dispatching Two Actions using dispatch Method.
const reducer = ( state = [],action) => {
if (action.type === 'split_string') {
return action.payload.split('');
} else if (action.type === 'add_character') {
state.push(action.payload);
return state;
}
return state;
};
const reducer = ( state = [],action) => {
if (action.type === 'split_string') {
return action.payload.split('');
}
return state;
};
const store = Redux.createStore(reducer);
store.getState();
@Salman18
Salman18 / Counter Button
Created October 25, 2017 06:41
Using Class and Functional Based Component
class Button extends React.Component {
render() {
return (
<button onClick={this.props.onClickFunction}>
{this.props.incrementValue}
</button>
);
}
}
@Salman18
Salman18 / Button.js
Created October 24, 2017 08:31
Button Component
class Button extends React.Component {
state = { counter: 0};
handleClick = () => {
this.setState((prevState) => ({
counter: prevState.counter + 1
}));
};
render() {