Skip to content

Instantly share code, notes, and snippets.

View reireynoso's full-sized avatar

Reinald Reynoso reireynoso

View GitHub Profile
@reireynoso
reireynoso / closure-ex-3.js
Created March 14, 2021 19:46
Closure example 3
let firstNumber = 200;
function getThatNumber(){
let firstNumber = 500;
function findNum(){
console.log('This is your number: ' + firstNumber)
}
findNum()
}
@reireynoso
reireynoso / closure-ex-2.js
Created March 14, 2021 19:40
Closure Example 2
let name = "Bob";
function hello(){
let greeting = "Heya";
function displayGreeting(){
console.log(greeting + ' ' + name)
}
displayGreeting();
}
@reireynoso
reireynoso / closure-ex-1.js
Created March 14, 2021 19:30
Closure Example
function greet(whattosay){
return function (name){
console.log(whattosay + ' ' + name)
}
}
const sayHi = greet("Hello")
sayHi('Person')
@reireynoso
reireynoso / index.js
Created September 29, 2020 21:56
Context API index
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { Provider } from "./GlobalState";
import reducer, { initialState } from "./reducer";
const rootElement = document.getElementById("root");
ReactDOM.render(
<React.StrictMode>
@reireynoso
reireynoso / GlobalState.js
Created September 29, 2020 20:41
Context API file
import React, { createContext, useContext, useReducer } from "react";
export const StateContext = createContext();
export const Provider = ({ reducer, initialState, children }) => (
<StateContext.Provider value={useReducer(reducer, initialState)}>
{children}
</StateContext.Provider>
);
@reireynoso
reireynoso / reducer.js
Created September 29, 2020 18:19
Context API reducer
export const initialState = {
view: "home"
};
const reducer = (state, action) => {
switch (action.type) {
case "SET_VIEW":
return {
...state,
view: action.view
@reireynoso
reireynoso / resume.md
Last active October 18, 2020 01:49
Resume

Reinald Reynoso

Full Stack Developer || Educator

Email: reireynoso@gmail.com
Phone: (201) 779-8062
Location: Jersey City, NJ
Github || LinkedIn || Personal Website

Summary:

Motivated web developer with experience building full stack applications with Javascript, NodeJS, ExpressJS, Ruby, React, Ruby on Rails, SQL and NoSQL databases, HTML/CSS, RESTful API architecture and MVC paradigm. Committed to education and EdTech principles contributing multiple programming concepts through blogs, videos, and repositories. Well-versed in instruction, collaboration, and complex problem solving.

@reireynoso
reireynoso / useRefdata.js
Last active July 21, 2020 00:39
useRef for storing mutable information
import React, {useRef, useState} from 'react'
const MessageInputComponent = () => {
const [message, setMessage] = useState("")
const sentMessage = useRef(0);
const sendMessage = () => {
if(sentMessage.current === 3){
return alert("Message Limit Reached")
}
@reireynoso
reireynoso / another-ref-sample.js
Last active October 14, 2020 01:18
Another component forward ref sample
import React from 'react'
const AnotherComponent = React.forwardRef((props, ref) => {
return (
<h1>Another Component</h1>
<input type="text" ref={ref} />
)
})
export default AnotherComponent
@reireynoso
reireynoso / ref-sample.js
Created July 19, 2020 23:14
Sample component restructured for forwardingRef
import React, { useRef } from "react";
import AnotherComponent from './AnotherComponent'
const SampleComponent = () => {
const textInputRef = useRef(null);
const buttonClick = () => textInputRef.current.focus();
return (
<React.Fragment>