Skip to content

Instantly share code, notes, and snippets.

View wnqueiroz's full-sized avatar
:octocat:

William Queiroz wnqueiroz

:octocat:
View GitHub Profile
@wnqueiroz
wnqueiroz / npm-i-package-lock-only.sh
Last active June 10, 2020 16:24
npm-i-package-lock-only.sh
$ npm i --package-lock-only
@wnqueiroz
wnqueiroz / styles.css
Last active November 1, 2019 17:50
Styles
body {
background-color: blue;
}
@wnqueiroz
wnqueiroz / Users-with-props-from-context.jsx
Created August 10, 2018 02:04
React Context: Users.jsx with props from context
import React, { Component } from 'react'
import { getUsers } from '../services/api'
class Users extends Component {
state = {
loading: false
}
@wnqueiroz
wnqueiroz / Departments-with-props-from-context.jsx
Created August 10, 2018 02:02
React Context: Departments.jsx with props from context
import React, { Component } from 'react'
import { getDepartments } from '../services/api'
class Departments extends Component {
state = {
loading: false
}
@wnqueiroz
wnqueiroz / App-with-loading-context-api-setup.jsx
Last active August 10, 2018 02:15
React Context: App.jsx with loading context api setup
import React, { Component, Fragment } from 'react'
import Departments from './components/Departments'
import Users from './components/Users'
import Loading from './components/Loading'
import './index.css'
const LoadingContext = React.createContext({
loading: false,
@wnqueiroz
wnqueiroz / App-with-loading-context.jsx
Last active August 10, 2018 02:16
React Context: App.jsx with loading context
import React, { Component, Fragment } from 'react'
import Departments from './components/Departments'
import Users from './components/Users'
import './index.css'
const LoadingContext = React.createContext({
loading: false,
message: null,
@wnqueiroz
wnqueiroz / Departments.jsx
Created August 9, 2018 19:11
React Context: Departments with Loading component
import React, { Component, Fragment } from 'react'
import Loading from './Loading'
import { getDepartments } from '../services/api'
class Departments extends Component {
state = {
loading: false
@wnqueiroz
wnqueiroz / Users.jsx
Created August 9, 2018 19:07
React Context: Users with Loading component
import React, { Component, Fragment } from 'react'
import Loading from './Loading'
import { getUsers } from '../services/api'
class Users extends Component {
state = {
loading: false
@wnqueiroz
wnqueiroz / Loading.jsx
Created August 9, 2018 19:02
React Context: src/components/Loading.jsx
import React from 'react'
import Spinner from 'react-spinkit'
const Loading = ({ loading, message }) => {
return loading ? (
<div className='overlay-content'>
<div className='wrapper'>
<Spinner
name='pacman'
@wnqueiroz
wnqueiroz / index.css
Last active August 9, 2018 18:52
React Context: index.css
.overlay-content {
display: flex;
width: 100%;
left: 0;
top: 0;
align-items: center;
height: 100%;
justify-content: center;
position: fixed;
z-index: 999999;