Skip to content

Instantly share code, notes, and snippets.

View RenatoLopes771's full-sized avatar
💯

RenatoLopes771

💯
View GitHub Profile
sudo su postgres
service postgresql start
@RenatoLopes771
RenatoLopes771 / cringe.js
Created December 22, 2021 20:54
Cringe JavaScript
console.log(
`Test ${() => ""}`
);
// Output:
// Test () => ""
@RenatoLopes771
RenatoLopes771 / useForm.js
Created December 22, 2021 20:47
Forms without libraries and thousands of use states
// By Ben Awad
import { useState } from "react";
export function useForm(initialValues) {
const [values, setValues] = useState(initialValues);
return [
values,
(e) => {
setValues({
@RenatoLopes771
RenatoLopes771 / conditionalRenderWindowSize.jsx
Last active December 6, 2021 16:04
React JS: do something on window scroll and conditional render on window size
export default function Footer() {
const [width, setWidth] = useState(window.innerWidth);
useEffect(() => {
window.onresize = () => {
setWidth(parseInt(window.innerWidth));
}
}, []);