childrentime
Repos
43
Followers
11
Following
15

Collection of essential React Hooks Utilities.

11
0

Events

chore: release v1.1.5

Created at 21 hours ago

feat: update website

Created at 1 day ago

feat: update website

Created at 1 day ago
issue comment
Change the default output syntax level

I set it to es2018, but still get error TS2802: Type 'IterableIterator<number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. with bunchee version 2.2.0

Created at 1 day ago
started
Created at 1 day ago
issue comment
Change the default output syntax level

can bunchee use typescript ouput version?

Created at 1 day ago
childrentime create tag v1.1.4
Created at 3 days ago

docs(useEvent): add comment

feat: add useOnceEffect useOnceLayoutEffect

chore: release v1.1.4

Created at 3 days ago
started
Created at 4 days ago
issue comment
Add hook to avoid concurrent runs

a simple hook can do this

  const record = new WeakSet();
export const useOnceEffect = (fn: any, dep: any) => {
  const onceWrapper = () => {
    const shouldStart= !record.has(fn);
    if(shouldStart){
      record.add(fn);
      fn();
    }
  }
  useEffect(onceWrapper, dep);
};
Created at 4 days ago
issue comment
A new hook for synchronous one-time effect for client and ssr

update: a new solution

import { useId } from "react";
const record = new Set();

export const useOnce = (fn: any) => {
  const id = useId();
  const shouldStart = !record.has(id);
  if (shouldStart) {
    record.add(id);
    fn();
  }
};

it works well in lateset nextjs framework

Created at 4 days ago
issue comment
Add hook to avoid concurrent runs

if you want useEffect run once, just do this

export const useOnceEffect = (fn: any, dep: any) => {

  const record = new WeakSet();
  const onceWrapper = () => {
    const shouldStart= !record.has(fn);
    if(shouldStart){
      record.add(fn);
      fn();
    }
  }
  useEffect(onceWrapper, dep);
};
Created at 4 days ago
started
Created at 6 days ago

feat: update

Created at 1 week ago

🐎 ci: update

Created at 1 week ago

feat: update

Created at 1 week ago
issue comment
Feature proposal: add a hook that allows a component to support both controlled and uncontrolled modes

hi, here useControlled

Created at 1 week ago
childrentime create tag v1.1.3
Created at 1 week ago

feat: add useControlled

chore: release v1.1.3

Created at 1 week ago
childrentime create tag v1.1.2
Created at 1 week ago

feat: useFocus

feat: useFocus

chore: release v1.1.2

Created at 1 week ago
Created at 3 weeks ago
Created at 4 weeks ago
Created at 4 weeks ago
Created at 4 weeks ago
issue comment
A new hook for synchronous one-time effect for client and ssr

I find a possible solution.

let lock = false;
function Home() {

  if(!lock){
    lock = true;
    console.log('do something')
  }

return <div></div>
Created at 1 month ago
issue comment
A new hook for synchronous one-time effect for client and ssr

useRef will also exec twice

Created at 1 month ago