Skip to content

Commit

Permalink
feat(use-longer-state): new longer state (#38)
Browse files Browse the repository at this point in the history
* feat(use-longer-state): new longer state

* refactor: call nested hook instead of expose from app.tsx

* fix: it should wrote like this one
  • Loading branch information
sikkapat79 authored Oct 1, 2022
1 parent 5cc995f commit 1821350
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useRandom } from "./hooks/useRandom"
import { useDivisibleByThree } from "./hooks/useDivisibleByThree"
import { useSalim } from "./hooks/useSalim"
import { useAny } from "./hooks/useAny"
import { useLongerState } from "./hooks/useLongerState"
import { useSkoy } from "./hooks/useSkoy"

const UseWeirdExampleComponent = () => {
Expand Down Expand Up @@ -46,6 +47,7 @@ const UseSalimExampleComponent = () => {
}

function App() {

const hooks: CardProps[] = [
{
desc: "useLess - a useless hook that returns initial value.",
Expand Down Expand Up @@ -205,6 +207,16 @@ function App() {
],
githubUsername: "narze",
},
{
desc: "useLongerState - it will return such a longer hook than original useState. Hahaha",
examples: [
{
code: "const [countLongerState , setCountLongerState] = useLongerState[0]",
value: `Current count is ${useLongerState(0)[0]}`
}
],
githubUsername: "sikkapat79"
},
{
desc: "useSkoy - returns SkoyLang for us SkoyPeople",
examples: [
Expand Down
5 changes: 5 additions & 0 deletions src/hooks/useLongerState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { useState } from "react";

export const useLongerState = <T = unknown>(yourInput: T) => {
return useState(yourInput);
}

1 comment on commit 1821350

@vercel
Copy link

@vercel vercel bot commented on 1821350 Oct 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

react-useless – ./

react-useless-git-main-notnarze.vercel.app
react-useless-notnarze.vercel.app
react-useless.vercel.app

Please sign in to comment.