Skip to content

Instantly share code, notes, and snippets.

View 01Clarian's full-sized avatar

Clarian 01Clarian

  • NFTuity
  • New York
View GitHub Profile
@01Clarian
01Clarian / Weather.js
Created November 16, 2019 17:04
FInish Weather Keyword Search
import React from 'react'
const Weather = ({description, city, country, error, temperature}) => {
function matchValues () {
if(description) {
const weatherDescription = description.split(' ')
const keyWords = ['cloudy','clouds', 'cloud', 'overcast']
for(let i = 0; i < weatherDescription.length; i++) {
if(keyWords.includes(weatherDescription[i])) {
@01Clarian
01Clarian / script.js
Created November 24, 2019 15:57
Initial Memoization Example Notes
// MEMOIZATION AND CACHING: THE CONSTRUCTION FUNCTION EXAMPLE
// In order to better our understanding of Memoization, we will write a function
// entitled 'Building' and apply various logged results to observe the behaviour
// of JavaScript.
// ****Additional Notes****
// In this example, you are the boss of a construction company.
// The construction company will be a reference to your Application.
@01Clarian
01Clarian / ClickCounter.jsx
Created November 30, 2019 18:53
Click Counter Pre HOC
import React from 'react';
class ClickCounter extends React.Component {
constructor() {
super()
this.state = {
count: 0
}
}
increment = () => {
@01Clarian
01Clarian / HoverCounter.jsx
Created November 30, 2019 19:08
HoverCounter Pre HOC
import React from 'react';
class HoverCounter extends React.Component {
constructor() {
super()
this.state = {
count: 0
}
}
increment = () => {
@01Clarian
01Clarian / HoverCounter.jsx
Created November 30, 2019 19:09
HoverCounter pre HOC pattern
import React from 'react';
class HoverCounter extends React.Component {
constructor() {
super()
this.state = {
count: 0
}
}
increment = () => {
@01Clarian
01Clarian / EnhanceComponent.js
Created November 30, 2019 19:27
HOC to enhance Click and Hover Component
import React from 'react'
const EnhanceComponent = (OrignComponent) => {
class ModComponent extends React.Component {
constructor() {
super()
this.state = {
count: 0
}
@01Clarian
01Clarian / EnhanceComponent.js
Created November 30, 2019 19:28
HOC for Click Counter and Hover Counter Component
import React from 'react'
const EnhanceComponent = (OrignComponent) => {
class ModComponent extends React.Component {
constructor() {
super()
this.state = {
count: 0
}
@01Clarian
01Clarian / ClickCounter.jsx
Created November 30, 2019 20:27
ClickCounter refactored for HOC pattern
import React from 'react';
import EnhanceComponent from './EnhanceComponent';
const ClickCounter = (props) => {
return (
<button onClick={props.increment}>
{props.count}</button>
);
}
@01Clarian
01Clarian / HoverCounter.jsx
Created November 30, 2019 20:35
HoverCounter Component Refactored HOC Pattern
import React from 'react';
import EnhanceComponent from './EnhanceComponent'
const HoverCounter = (props) => {
return (
<h2 onMouseOver={props.increment}>
{props.count}</h2>
);
}
export default EnhanceComponent(HoverCounter);
@01Clarian
01Clarian / products.provider.js
Created December 10, 2019 17:45
Products Provider Test demonstration
import React,{createContext, useState} from 'react'
export const ProductsContext = createContext({
test: ''
})
const ProductsProvider = ({children}) => {
const [test] = useState('the products provider has been successfully connected :)')
return (
<ProductsContext.Provider value={{test}}>