Skip to content

Instantly share code, notes, and snippets.

Avatar

Clarian 01Clarian

  • NFTuity
  • New York
View GitHub Profile
@01Clarian
01Clarian / App.js
Created Jan 12, 2020
Parent Application that takes weather component basic data and counter click
View App.js
import React,{useState} from 'react';
import Weather from './Weather'
import './App.css';
function App() {
const [counter, setCounter] = useState(0)
const [weather] = useState({city:'Miami', temperature:'80F'})
return (
<div className="App">
<Weather weather={weather} />
@01Clarian
01Clarian / Weather.js
Created Jan 12, 2020
Component that Display Weather
View Weather.js
import React from 'react'
const Weather = ({weather}) => {
return (
<div>
<p>{weather.city}</p>
<p>{weather.temperature}</p>
{console.log('Render')}
</div>
)
View Inclusive Array Recursion Function
function inclusiveArrayParamRecursive(startVal, endVal) {
if(startVal >= endVal) {
return [startVal]
} else {
const arr = inclusiveArrayParamRecursive(startVal, endVal - 1)
arr.push(endVal)
return arr
}
}
View Iterative Solution For Inclusive Array parm
function inclusiveArrayParam(startVal, endVal) {
const arr = []
for(let i = startVal; i <= endVal; i++) {
arr.push(i)
}
return arr
}
console.log('iterative inclusive array solution: ', inclusiveArrayParam(2, 6))
@01Clarian
01Clarian / index.js
Created Dec 16, 2019
Final Conversion Kelvin Currying Example Code
View index.js
//grabbing the dom ids:
const convertKelvin = document.querySelector('#convertKelvin')
const results = document.querySelector('#results')
const kelvinNumber = document.getElementById('kelvinNumber')
convertKelvin.onclick = () => {
console.log('test')
//convertKelvinReg(300)
const currier = convertKelvinCurried(kelvinNumber.value)()
currier
@01Clarian
01Clarian / index.js
Created Dec 16, 2019
FInal Currying Kelvin Conversion Example Code
View index.js
//grabbing the dom ids:
const convertKelvin = document.querySelector('#convertKelvin')
const results = document.querySelector('#results')
const kelvinNumber = document.getElementById('kelvinNumber')
convertKelvin.onclick = () => {
console.log('test')
//convertKelvinReg(300)
const currier = convertKelvinCurried(kelvinNumber.value)()
currier
@01Clarian
01Clarian / index.js
Created Dec 16, 2019
Kelvin Conversion Function with Hardcoded Kelvin Argument
View index.js
//grabbing the dom ids:
const convertKelvin = document.querySelector('#convertKelvin')
const results = document.querySelector('#results')
const kelvinNumber = document.getElementById('kelvinNumber')
convertKelvin.onclick = () => {
console.log('test')
convertKelvinReg(300)
}
@01Clarian
01Clarian / index.js
Created Dec 16, 2019
Hooking Up To The DOM and Selectors
View index.js
//grabbing the dom ids:
const convertKelvin = document.querySelector('#convertKelvin')
const results = document.querySelector('#results')
const kelvinNumber = document.getElementById('kelvinNumber')
convertKelvin.onclick = () => {
console.log('test')
}
@01Clarian
01Clarian / index.html
Created Dec 16, 2019
Converter Kelvin to Fahrenheit Example HTML
View index.html
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Currying Example</title>
</head>
<body>
<div id="DOM">
@01Clarian
01Clarian / productsContainer.js
Created Dec 10, 2019
Switching products data from Redux to Context Api
View productsContainer.js
import React,{useContext} from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { addToCart } from '../actions'
import { getVisibleProducts } from '../reducers/products'
import ProductItem from '../components/ProductItem'
import ProductsList from '../components/ProductsList'
import {ProductsContext} from '../provider/products.provider'
const ProductsContainer = ({ addToCart }) => {