Skip to content

Instantly share code, notes, and snippets.

@kensaaa
kensaaa / useForm.js
Last active May 22, 2022 15:15
React: Custom hook form
import {useState} from "react"
export const useForm = (initialState = {}) => {
const [values,setValues] = useState(initialState)
const reset = () => {
setValues(initialState)
}
@kensaaa
kensaaa / assets.d.ts
Created June 3, 2022 19:55
React: .d.ts para que no de error al agregar una imagen
declare module '*.jpg' {
const content: any; // you can also set this to string
export default content;
}
@kensaaa
kensaaa / CounterReducer.tsx
Created June 10, 2022 15:13
React: example reducer typescript
import {useReducer, useState} from "react"
interface CounterState {
counter: number
previus: number
changes: number
}
const INITIAL_STATE:CounterState = {
@kensaaa
kensaaa / kitty.conf
Created June 10, 2022 17:56
file configurator: kitty terminal , ubicacion: ~/.config/kitty/kitty.conf
font_family Caskaydia Cove Nerd Font
font_size 12.0
background_opacity .8
remember_window_size no
initial_window_width 640
initial_window_height 350
cursor_shape beam
cursor_beam_thickness 1.8
@kensaaa
kensaaa / redshift.conf
Created June 10, 2022 17:58
file config: redshift , ubicacion: ~/.config/redshift
[redshift]
temp-day=5800
temp-night=2400
transition=0
gamma=0.8
location-provider=manual
[manual]
lat=-33.5
lon=-70.5
[randr]
@kensaaa
kensaaa / gitconfig
Created June 10, 2022 18:01
File Config: git , ubicacion: ~/.gitconfig
[user]
name = kensaaa
email = ke.samata.ramos@gmail.com
[core]
editor = nvim
[alias]
s = status -sb
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
[github]
user = kensaaa
@kensaaa
kensaaa / vite-testing-config.md
Last active June 28, 2022 23:09 — forked from Klerith/vite-testing-config.md
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom

# esto en caso de trabajar con typescript
yarn add --dev @babel/preset-typescript
@kensaaa
kensaaa / CounterWithCustomHook.tsx
Created June 15, 2022 19:46
React Typescript: custom hook useCounter
import { useCounter } from "../hooks/useCounter";
const CounterWithCustomHook = () => {
const { counter, increment, decrement, reset } = useCounter(10);
return (
<>
<h1>Counter With Hook: {counter}</h1>
<hr />
@kensaaa
kensaaa / useForm.ts
Created June 15, 2022 21:13
React Typescript: custom hook useForm
import { useState } from 'react';
interface useFormReturn {
formState: any;
onInputChange(e: any): void;
onResetForm(): void;
}
export const useForm = (initalForm = {}): useFormReturn => {
const [formState, setFormState] = useState(initalForm);
@kensaaa
kensaaa / templateSlice.js
Created June 24, 2022 15:18 — forked from Klerith/templateSlice.js
Cascaron para crear Redux Slices rápidamente
import { createSlice } from '@reduxjs/toolkit';
export const templateSlice = createSlice({
name: 'name',
initialState: {
counter: 10
},
reducers: {
increment: (state, /* action */ ) => {
//! https://react-redux.js.org/tutorials/quick-start