React hooks for RxJS

Overview

React hooks for RxJS

CircleCI codecov npm version

Installation

Using npm:

$ npm i --save rxjs-hooks

Or yarn:

$ yarn add rxjs-hooks

Quick look

import React from "react";
import ReactDOM from "react-dom";
import { useObservable } from "rxjs-hooks";
import { interval } from "rxjs";
import { map } from "rxjs/operators";

function App() {
  const value = useObservable(() => interval(500).pipe(map((val) => val * 3)));

  return (
    <div className="App">
      <h1>Incremental number: {value}</h1>
    </div>
  );
}
import React from "react";
import ReactDOM from "react-dom";
import { useEventCallback } from "rxjs-hooks";
import { map } from "rxjs/operators";

function App() {
  const [clickCallback, [description, x, y]] = useEventCallback((event$) =>
    event$.pipe(
      map((event) => [event.target.innerHTML, event.clientX, event.clientY]),
    ),
    ["nothing", 0, 0],
  )

  return (
    <div className="App">
      <h1>click position: {x}, {y}</h1>
      <h1>"{description}" was clicked.</h1>
      <button onClick={clickCallback}>click me</button>
      <button onClick={clickCallback}>click you</button>
      <button onClick={clickCallback}>click him</button>
    </div>
  );
}

Apis

useObservable

export type InputFactory<State> = (state$: Observable<State>) => Observable<State>
export type InputFactoryWithInputs<State, Inputs> = (
  state$: Observable<State>,
  inputs$: Observable<RestrictArray<Inputs>>,
) => Observable<State>

export function useObservable<State>(inputFactory: InputFactory<State>): State | null
export function useObservable<State>(inputFactory: InputFactory<State>, initialState: State): State
export function useObservable<State, Inputs>(
  inputFactory: InputFactoryWithInputs<State, Inputs>,
  initialState: State,
  inputs: RestrictArray<Inputs>,
): State

Examples:

import React from 'react'
import ReactDOM from 'react-dom'
import { useObservable } from 'rxjs-hooks'
import { of } from 'rxjs'

function App() {
  const value = useObservable(() => of(1000))
  return (
    // render twice
    // null and 1000
    <h1>{value}</h1>
  )
}

ReactDOM.render(<App />, document.querySelector('#app'))

With default value:

import React from 'react'
import ReactDOM from 'react-dom'
import { useObservable } from 'rxjs-hooks'
import { of } from 'rxjs'

function App() {
  const value = useObservable(() => of(1000), 200)
  return (
    // render twice
    // 200 and 1000
    <h1>{value}</h1>
  )
}

ReactDOM.render(<App />, document.querySelector('#app'))

Observe props change:

import React from 'react'
import ReactDOM from 'react-dom'
import { useObservable } from 'rxjs-hooks'
import { of } from 'rxjs'
import { map } from 'rxjs/operators'

function App(props: { foo: number }) {
  const value = useObservable((_, inputs$) => inputs$.pipe(
    map(([val]) => val + 1),
  ), 200, [props.foo])
  return (
    // render three times
    // 200 and 1001 and 2001
    <h1>{value}</h1>
  )
}

ReactDOM.render(<App foo={1000} />, document.querySelector('#app'))
ReactDOM.render(<App foo={2000} />, document.querySelector('#app'))

useObservable with state$

live demo

import React from 'react'
import ReactDOM from 'react-dom'
import { useObservable } from 'rxjs-hooks'
import { interval } from 'rxjs'
import { map, withLatestFrom } from 'rxjs/operators'

function App() {
  const value = useObservable((state$) => interval(1000).pipe(
    withLatestFrom(state$),
    map(([_num, state]) => state * state),
  ), 2)
  return (
    // 2
    // 4
    // 16
    // 256
    // ...
    <h1>{value}</h1>
  )
}

ReactDOM.render(<App />, document.querySelector('#root'))

useEventCallback

Examples:

import React from 'react'
import ReactDOM from 'react-dom'
import { useEventCallback } from 'rxjs-hooks'
import { mapTo } from 'rxjs/operators'

function App() {
  const [clickCallback, value] = useEventCallback((event$: Observable<React.SyntheticEvent<HTMLButtonElement>>) =>
    event$.pipe(
      mapTo(1000)
    )
  )
  return (
    // render null
    // click button
    // render 1000
    <>
      <h1>{value}</h1>
      <button onClick={clickCallback}>click me</button>
    </>
  )
}

ReactDOM.render(<App />, document.querySelector('#app'))

With initial value:

import React from 'react'
import ReactDOM from 'react-dom'
import { useEventCallback } from 'rxjs-hooks'
import { mapTo } from 'rxjs/operators'

function App() {
  const [clickCallback, value] = useEventCallback((event$: Observable<React.SyntheticEvent<HTMLButtonElement>>) =>
    event$.pipe(
      mapTo(1000)
    ),
    200,
  )
  return (
    // render 200
    // click button
    // render 1000
    <>
      <h1>{value}</h1>
      <button onClick={clickCallback}>click me</button>
    </>
  )
}

ReactDOM.render(<App />, document.querySelector('#app'))

With state$:

live demo

import React from "react";
import ReactDOM from "react-dom";
import { useEventCallback } from "rxjs-hooks";
import { map, withLatestFrom } from "rxjs/operators";

function App() {
  const [clickCallback, [description, x, y, prevDescription]] = useEventCallback(
    (event$, state$) =>
      event$.pipe(
        withLatestFrom(state$),
        map(([event, state]) => [
           event.target.innerHTML,
           event.clientX,
           event.clientY,
          state[0],
        ])
      ),
    ["nothing", 0, 0, "nothing"]
  );

  return (
    <div className="App">
      <h1>
        click position: {x}, {y}
      </h1>
      <h1>"{description}" was clicked.</h1>
      <h1>"{prevDescription}" was clicked previously.</h1>
      <button onClick={clickCallback}>click me</button>
      <button onClick={clickCallback}>click you</button>
      <button onClick={clickCallback}>click him</button>
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

A complex example: useEventCallback with both inputs$ and state$

live demo

import React, { useState } from "react";
import ReactDOM from "react-dom";
import { useEventCallback } from "rxjs-hooks";
import { map, withLatestFrom, combineLatest } from "rxjs/operators";

import "./styles.css";

function App() {
  const [count, setCount] = useState(0);
  const [clickCallback, [description, x, y, prevDesc]] = useEventCallback(
    (event$, state$, inputs$) =>
      event$.pipe(
        map(event => [event.target.innerHTML, event.clientX, event.clientY]),
        combineLatest(inputs$),
        withLatestFrom(state$),
        map(([eventAndInput, state]) => {
          const [[text, x, y], [count]] = eventAndInput;
          const prevDescription = state[0];
          return [text, x + count, y + count, prevDescription];
        })
      ),
    ["nothing", 0, 0, "nothing"],
    [count]
  );

  return (
    <div className="App">
      <h1>
        click position: {x}, {y}
      </h1>
      <h1>"{description}" was clicked.</h1>
      <h1>"{prevDesc}" was clicked previously.</h1>
      <button onClick={clickCallback}>click me</button>
      <button onClick={clickCallback}>click you</button>
      <button onClick={clickCallback}>click him</button>
      <div>
        <p>
          click buttons above, and then click this `+++` button, the position
          numbers will grow.
        </p>
        <button onClick={() => setCount(count + 1)}>+++</button>
      </div>
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Example of combining callback observables coming from separate elements - animation with start/stop button and rate controllable via slider

live demo

const Animation = ({ frame }) => {
  const frames = "|/-\\|/-\\|".split("");
  return (
    <div>
      <p>{frames[frame % frames.length]}</p>
    </div>
  );
};


const App = () => {
  const defaultRate = 5;

  const [running, setRunning] = useState(false);

  const [onEvent, frame] = useEventCallback(events$ => {
    const running$ = events$.pipe(
      filter(e => e.type === "click"),
      scan(running => !running, running),
      startWith(running),
      tap(setRunning)
    );

    return events$.pipe(
      filter(e => e.type === "change"),
      map(e => parseInt(e.target.value, 10)),
      startWith(defaultRate),
      switchMap(i => timer(200, 1000 / i)),
      withLatestFrom(running$),
      filter(([_, running]) => running),
      scan(frame => frame + 1, 0)
    );
  });

  return (
    <div className="App">
      <button onClick={onEvent}>{running ? "Stop" : "Start"}</button>
      <input
        type="range"
        onChange={onEvent}
        defaultValue={defaultRate}
        min="1"
        max="10"
      ></input>
      <Animation frame={frame} />
    </div>
  );
};
Comments
  • An in-range update of webpack is breaking the build 🚨

    An in-range update of webpack is breaking the build 🚨

    The devDependency webpack was updated from 4.39.1 to 4.39.2.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your CircleCI tests were canceled (Details).

    Release Notes for v4.39.2

    Bugfixes

    • fix ProfilingPlugin not ending traces correctly
    Commits

    The new version differs by 38 commits.

    • 7265427 4.39.2
    • 9f27d0c Merge pull request #9559 from jamesgeorge007/feat/refactor-banner-plugin
    • b50a995 Merge pull request #9568 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.15.1
    • 385fe6a chore(deps-dev): bump eslint-plugin-jest from 22.15.0 to 22.15.1
    • 7ea8665 Merge pull request #9566 from timneutkens/fix/profiling-callback-override
    • 069c33a Fix asyncHook callback interceptor for ProfilingPlugin
    • ba56f7e Merge pull request #9564 from webpack/dependabot/npm_and_yarn/acorn-6.3.0
    • bd7655c chore(deps): bump acorn from 6.2.1 to 6.3.0
    • e62b643 Merge pull request #9558 from jamesgeorge007/hotfix/fix-typo
    • d7486fd fix: revert
    • aed5cce minor fix
    • 4f003c2 tweak
    • fa3b3ef refactor
    • 72ee5a3 fix: lint
    • af8906d fix: refactor

    There are 38 commits in total.

    See the full diff

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 8
  • An in-range update of @types/lodash is breaking the build 🚨

    An in-range update of @types/lodash is breaking the build 🚨

    The devDependency @types/lodash was updated from 4.14.137 to 4.14.138.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    @types/lodash is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your CircleCI tests were canceled (Details).

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 7
  • reduce object creation by useMemo

    reduce object creation by useMemo

    Hi, thank you for creating this amazing library!

    I've noticed there are some performance improvements can be done by using useMemo in useEventCallback hook. The change basically leverage the lazy evaluations and reduce new object creations at run-time.

    Thank you!

    opened by leoyli 7
  • Feature Request: need to subscribe action$ when apply useReducer

    Feature Request: need to subscribe action$ when apply useReducer

    When I am doing your hire problem 3 and 4: write a autocomplete component. I am using useReducer to manage state. Then I found the useObservable and useEventCallback can not solve the problem properly.

    It's more suitale to subscribe to the action stream when works with useReducer. And I have written a simple custom hook ‘useReducerEffect’ to solve the problem, but still meet some difficulty.

    My idea:

    1. Call the useReducer hook, which return state and dispatch.
    2. Pass state and dispatch and other params into 'useReducerEffect'.
    3. Replace dispatch with dispatchWithEffect for the particular action.
    type EffectFactory<Action, State> =
      (action$: Observable<Action>, state$: Observable<State>) => Observable<any>
    
    const [state, dispatch] = useReducer(reducer, initialState, initalAction)
    const [result, dispatchWithEffect] =
      useReducerEffect(effectFactory, state, dispatch, initalAction, initialResult)
    

    Now we have two versions of dispatch. You can call orignal 'dispatch', but this action will not appear in the effectFactory's action$. And the action dispatched by 'dispatchWithEffect' will appear. The state$ in effectFactory is guaranteed to be up to date. This means when a action comes in effectFactory's action$, this action already passed the reducer and updated the state.

    My examples is here.

    question 
    opened by Luminqi 7
  • An in-range update of lint-staged is breaking the build 🚨

    An in-range update of lint-staged is breaking the build 🚨

    The devDependency lint-staged was updated from 9.2.3 to 9.2.4.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    lint-staged is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your CircleCI tests were canceled (Details).

    Release Notes for v9.2.4

    9.2.4 (2019-08-25)

    Bug Fixes

    • include renames when getting list of staged files (2243a83)
    Commits

    The new version differs by 1 commits.

    • 2243a83 fix: include renames when getting list of staged files

    See the full diff

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 6
  • An in-range update of standard is breaking the build 🚨

    An in-range update of standard is breaking the build 🚨

    The devDependency standard was updated from 14.0.0 to 14.0.1.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    standard is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your CircleCI tests were canceled (Details).

    Commits

    The new version differs by 9 commits.

    See the full diff

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 6
  • An in-range update of webpack is breaking the build 🚨

    An in-range update of webpack is breaking the build 🚨

    The devDependency webpack was updated from 4.35.3 to 4.36.0.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your tests failed on CircleCI (Details).

    Release Notes for v4.36.0

    Features

    • SourceMapDevToolPlugin append option now supports the default placeholders in addition to [url]
    • Arrays in resolve and parser options (Rule and Loader API) support backreferences with "..." when overriding options.
    Commits

    The new version differs by 42 commits.

    • 95d21bb 4.36.0
    • aa1216c Merge pull request #9422 from webpack/feature/dot-dot-dot-merge
    • b3ec775 improve merging of resolve and parsing options
    • 53a5ae2 Merge pull request #9419 from vankop/remove-valid-jsdoc-rule
    • ab75240 Merge pull request #9413 from webpack/dependabot/npm_and_yarn/ajv-6.10.2
    • 0bdabf4 Merge pull request #9418 from webpack/dependabot/npm_and_yarn/eslint-plugin-jsdoc-15.5.2
    • f207cdc remove valid jsdoc rule in favour of eslint-plugin-jsdoc
    • 31333a6 chore(deps-dev): bump eslint-plugin-jsdoc from 15.3.9 to 15.5.2
    • 036adf0 Merge pull request #9417 from webpack/dependabot/npm_and_yarn/eslint-plugin-jest-22.8.0
    • 37d4480 Merge pull request #9411 from webpack/dependabot/npm_and_yarn/simple-git-1.121.0
    • ce2a183 chore(deps-dev): bump eslint-plugin-jest from 22.7.2 to 22.8.0
    • 0beeb7e Merge pull request #9391 from vankop/create-hash-typescript
    • bf1a24a #9391 resolve super call discussion
    • bd7d95b #9391 resolve discussions, AbstractMethodError
    • 4190638 chore(deps): bump ajv from 6.10.1 to 6.10.2

    There are 42 commits in total.

    See the full diff

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 6
  • An in-range update of husky is breaking the build 🚨

    An in-range update of husky is breaking the build 🚨

    The devDependency husky was updated from 3.0.4 to 3.0.5.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    husky is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your CircleCI tests were canceled (Details).

    Release Notes for v3.0.5

    Fix: prevent postinstall from failing on windows #573

    Commits

    The new version differs by 9 commits.

    • 2dd9985 3.0.5
    • e0b99e6 [Fix] Prevent postinstall from ever failing on windows (#573)
    • 2f56681 add table of contents (#572)
    • 03b0b2f Bump mixin-deep from 1.3.1 to 1.3.2 (#571)
    • e15e09e Delete DOCS.md
    • 75a38e1 Update README.md
    • 96dd62c Bump eslint-utils from 1.3.1 to 1.4.2 (#569)
    • d3e6a76 Next.js doesn't use husky now (#568)
    • 179ffbe Update README.md

    See the full diff

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 5
  • An in-range update of @types/webpack is breaking the build 🚨

    An in-range update of @types/webpack is breaking the build 🚨

    The devDependency @types/webpack was updated from 4.32.2 to 4.39.0.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    @types/webpack is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • ci/circleci: build: Your CircleCI tests were canceled (Details).

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 5
  • why useEventCallback's inputs$ and states$ opposite to their input argument order

    why useEventCallback's inputs$ and states$ opposite to their input argument order

      const [onEvent] = useEventCallback((events$, x$, y$) => {
        x$.subscribe(x => console.log('x ', x)) // log: x [false]
        y$.subscribe(y => console.log('y ', y)) // log: y [0]
      }, [0], [false]);
    

    I thinks x to be 0 and y to be false is expected, but useEventCallback give opposite result. Am I doing something wrong.

    versions info: rxjs-hooks: 0.4.3

    good first issue 
    opened by maple-leaf 5
  • How to combine observables from different useEventCallback?

    How to combine observables from different useEventCallback?

    Hi, I don't quite get how I can get to work combining together two streams made separately with useEventCallback. Here's what I would like to achieve: I have an animation, that can be controlled in two ways: user can click "run/stop" button and moreover he can control animation rate via slider input. I would like to use values from slider combined with button clicks mapped to "true/false", representing whether animation is running or not. Then I'd like to filter this combined stream based on this value, so in the end animation is triggered only when last click from the button turned it on again (with switchMap to interval() based on slider value). Here's a minimal reproduction of my code: https://codesandbox.io/s/pprzmxy230. How to fix it?

    question 
    opened by vicrac 5
  • chore(deps-dev): bump husky from 8.0.1 to 8.0.3

    chore(deps-dev): bump husky from 8.0.1 to 8.0.3

    Bumps husky from 8.0.1 to 8.0.3.

    Release notes

    Sourced from husky's releases.

    v8.0.3

    • fix: add git not installed message #1208

    v8.0.2

    • docs: remove deprecated npm set-script
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • chore(deps-dev): bump @vitest/coverage-c8 from 0.24.3 to 0.26.3

    chore(deps-dev): bump @vitest/coverage-c8 from 0.24.3 to 0.26.3

    Bumps @vitest/coverage-c8 from 0.24.3 to 0.26.3.

    Release notes

    Sourced from @​vitest/coverage-c8's releases.

    v0.26.3

       🚀 Features

       🐞 Bug Fixes

        View changes on GitHub

    v0.26.2

       🚀 Features

       🐞 Bug Fixes

        View changes on GitHub

    v0.26.1

       🚀 Features

       🐞 Bug Fixes

        View changes on GitHub

    v0.26.0

       🚨 Breaking Changes

    • vite-node: Rewrite how vite-node resolves id  -  by @​sheremet-va in vitest-dev/vitest#2463 (58ee8)
    • Correctly interop nested default for external and inlined modules  -  by @​sheremet-va in vitest-dev/vitest#2512 (084e9)
      • If your environment is node, Vitest will not resolve invalid named exports (exports that are on "default" property will not magically appear as named exports), unless deps.interopDefault is enabled, or dependency is in deps.inline. This change doesn't affect jsdom, happy-dom or edge environments.
    • web-worker: Make web-worker implementation more compatible with spec  -  by @​sheremet-va in vitest-dev/vitest#2431 (c3a63)
      • Messages are now cloned with structuredClone, if it's available, or fallbacks to a polyfill.
      • Added support for SharedWorker

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • chore(deps-dev): bump vitest from 0.24.3 to 0.26.3

    chore(deps-dev): bump vitest from 0.24.3 to 0.26.3

    Bumps vitest from 0.24.3 to 0.26.3.

    Release notes

    Sourced from vitest's releases.

    v0.26.3

       🚀 Features

       🐞 Bug Fixes

        View changes on GitHub

    v0.26.2

       🚀 Features

       🐞 Bug Fixes

        View changes on GitHub

    v0.26.1

       🚀 Features

       🐞 Bug Fixes

        View changes on GitHub

    v0.26.0

       🚨 Breaking Changes

    • vite-node: Rewrite how vite-node resolves id  -  by @​sheremet-va in vitest-dev/vitest#2463 (58ee8)
    • Correctly interop nested default for external and inlined modules  -  by @​sheremet-va in vitest-dev/vitest#2512 (084e9)
      • If your environment is node, Vitest will not resolve invalid named exports (exports that are on "default" property will not magically appear as named exports), unless deps.interopDefault is enabled, or dependency is in deps.inline. This change doesn't affect jsdom, happy-dom or edge environments.
    • web-worker: Make web-worker implementation more compatible with spec  -  by @​sheremet-va in vitest-dev/vitest#2431 (c3a63)
      • Messages are now cloned with structuredClone, if it's available, or fallbacks to a polyfill.
      • Added support for SharedWorker

    ... (truncated)

    Commits
    • 8d64790 chore: release v0.26.3
    • dba1337 fix(coverage): env-replacer to remove query params from sourcemaps filenames ...
    • 32a577b fix: show list of tests when typechecking (#2585)
    • c479d9c fix: don't hang when mocking module with circular dependency (#2572)
    • 9f41edd fix: start tracking module resolution as soon as possible for easier tracking...
    • ef77dcc fix(api): make api parse error stacks and return sourcePos in onTaskUpdate (#...
    • 853eedd feat(mock): expose a importOriginal helper to the factory (#2551)
    • 07ef0f2 chore: release v0.26.2
    • f6b592a fix(cli): respect inline config dir (#2550)
    • 84f98e7 feat: project name
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • chore(deps-dev): bump @types/react-dom from 18.0.7 to 18.0.10

    chore(deps-dev): bump @types/react-dom from 18.0.7 to 18.0.10

    Bumps @types/react-dom from 18.0.7 to 18.0.10.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • chore(deps-dev): bump typescript from 4.8.4 to 4.9.4

    chore(deps-dev): bump typescript from 4.8.4 to 4.9.4

    Bumps typescript from 4.8.4 to 4.9.4.

    Release notes

    Sourced from typescript's releases.

    TypeScript 4.9.4

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    Downloads are available on:

    Changes:

    • e2868216f637e875a74c675845625eb15dcfe9a2 Bump version to 4.9.4 and LKG.
    • eb5419fc8d980859b98553586dfb5f40d811a745 Cherry-pick #51704 to release 4.9 (#51712)
    • b4d382b9b12460adf2da4cc0d1429cf19f8dc8be Cherry-pick changes for narrowing to tagged literal types.
    • e7a02f43fce47e1a39259ada5460bcc33c8e98b5 Port of #51626 and #51689 to release-4.9 (#51627)
    • 1727912f0437a7f367d90040fc4b0b4f3efd017a Cherry-pick fix around visitEachChild to release-4.9. (#51544)

    This list of changes was auto generated.

    TypeScript 4.9

    For release notes, check out the release announcement.

    Downloads are available on:

    Changes:

    • 93bd577458d55cd720b2677705feab5c91eb12ce Bump version to 4.9.3 and LKG.
    • 107f832b80df2dc97748021cb00af2b6813db75b Update LKG.
    • 31bee5682df130a14ffdd5742f994dbe7313dd0e Cherry-pick PR #50977 into release-4.9 (#51363) [ #50872 ]
    • 1e2fa7ae15f8530910fef8b916ec8a4ed0b59c45 Update version to 4.9.2-rc and LKG.
    • 7ab89e5c6e401d161f31f28a6c555a3ba530910e Merge remote-tracking branch 'origin/main' into release-4.9
    • e5cd686defb1a4cbdb36bd012357ba5bed28f371 Update package-lock.json
    • 8d40dc15d1b9945837e7860320fdccfe27c40cad Update package-lock.json
    • 5cfb3a2fe344a5350734305193e6cc99516285ca Only call return() for an abrupt completion in user code (#51297)
    • a7a9d158e817fcb0e94dc1c24e0a401b21be0cc9 Fix for broken baseline in yieldInForInInDownlevelGenerator (#51345)
    • 7f8426f4df0d0a7dd8b72079dafc3e60164a23b1 fix for-in enumeration containing yield in generator (#51295)
    • 3d2b4017eb6b9a2b94bc673291e56ae95e8beddd Fix assertion functions accessed via wildcard imports (#51324)
    • 64d0d5ae140b7b26a09e75114517b418d6bcaa9f fix(51301): Fixing an unused import at the end of a line removes the newline (#51320)
    • 754eeb2986bde30d5926e0fa99c87dda9266d01b Update CodeQL workflow and configuration, fix found bugs (#51263)
    • d8aad262006ad2d2c91aa7a0e4449b4b83c57f7b Update package-lock.json
    • d4f26c840b1db76c0b25a405c8e73830a2b45cbc fix(51245): Class with parameter decorator in arrow function causes "convert to default export" refactoring failure (#51256)
    • 16faf45682173ea437a50330feb4785578923d7f Update package-lock.json
    • 8b1ecdb701e2a2e19e9f8bcdd6b2beac087eabee fix(50654): "Move to a new file" breaks the declaration of referenced variable (#50681)
    • 170a17fad57eae619c5ef2b7bdb3ac00d6c32c47 Dom update 2022-10-25 (#51300)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • chore(deps-dev): bump vite from 3.1.8 to 3.2.5

    chore(deps-dev): bump vite from 3.1.8 to 3.2.5

    Bumps vite from 3.1.8 to 3.2.5.

    Release notes

    Sourced from vite's releases.

    [email protected]

    Please refer to CHANGELOG.md for details.

    [email protected]

    Please refer to CHANGELOG.md for details.

    Changelog

    Sourced from vite's changelog.

    3.2.5 (2022-12-05)

    3.2.4 (2022-11-15)

    3.2.3 (2022-11-07)

    3.2.2 (2022-10-31)

    3.2.1 (2022-10-28)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
Releases(v0.8.0-alpha.0)
Owner
LeetCode Open Source
LeetCode Open Source
👩‍🍳 A React Hooks utility library containing popular customized hooks

React Recipes A React Hooks utility library containing popular customized hooks What's your favorite dish? npm i react-recipes --save yarn add react-r

Craig Walker 931 Dec 28, 2022
🍹 A lot of nice hooks to make react hooks easier to use ( useState callback / life cycle / instance variable)

?? Nice Hooks 中文版 A lot of nice hooks to make react hooks easier to use. If you find this project is useful to you, please give me a star. Installatio

Daniel.xiao 46 Dec 28, 2022
🔥 A collection of beautiful and (hopefully) useful React hooks to speed-up your components and hooks development 🔥

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development ?? Live playground here ?? ???? English

Antonio Rù 6.5k Dec 29, 2022
Learn the more advanced React hooks and different patterns to enable great developer APIs for custom hooks

?? Advanced React Hooks ?? EpicReact.Dev Learn the more advanced React hooks and different patterns to enable great developer APIs for custom hooks. W

José Gonçalves 4 Mar 15, 2022
Use-supabase-hooks contains react hooks for common supabase functions, with type safety!

Use-supabase-hooks contains react hooks for common supabase functions, with type safety!

Anurag 15 Oct 23, 2022
ReactJs Custom hooks, component lifecycle - Indispensable hooks

ReactJs Custom hooks, component lifecycle - Indispensable hooks

Alan Buscaglia 71 Dec 27, 2022
Travel Website is a React application that uses React Hooks and React Router for this beginner React JS Project

Travel Website is a React application that uses React Hooks and React Router for this beginner React JS Project. The website is fully responsive as well.

Leticia Lumi Nagao 3 Aug 28, 2022
React Native APIs turned into React Hooks for use in functional React components

React Native Hooks React Native APIs turned into React Hooks allowing you to access asynchronous APIs directly in your functional components. Note: Yo

React Native Community 3k Jan 8, 2023
React-cache-api - React Cache API is a React Hooks library for data fetching

React Cache API React Cache API is a React Hooks library for data fetching. It w

awmaker 12 Aug 31, 2022
:tada: React Universal Hooks : just use****** everywhere (Functional or Class Component). Support React DevTools!

react-universal-hooks React Universal Hooks : just use****** everywhere. Support React >= 16.8.0 Installation Using npm: $ npm install --save react-un

Salvatore Ravidà 177 Oct 10, 2022
Lightweight React bindings for MobX based on React 16.8 and Hooks

mobx-react-lite ?? ?? ?? This repo has been moved to mobx This is a lighter version of mobx-react which supports React functional components only and

MobX 2.1k Dec 15, 2022
A delightful modal dialog component for React, built from the ground up to support React Hooks.

?? modali A delightful modal dialog library for React, built from the ground up to support React Hooks. Modali provides a simple interface to build be

Upmostly 205 Nov 23, 2022
React Redux binding with React Hooks and Proxy

There are several projects related to this repo. Here's the index of those. reactive-react-redux v5-alpha (this repo): This has an experimental react-

Daishi Kato 504 Dec 30, 2022
📋 React Hooks for forms validation (Web + React Native)

Performant, flexible and extensible forms with easy to use validation. English | 繁中 | 简中 | 日本語 | 한국어 | Français | Italiano | Português | Español | Рус

React Hook Form 32.5k Jan 2, 2023
react-pirate React lifecycle and utilities hooks.

??‍☠️ React Pirate Hooks for React 16.7 and above. Arrrr. Installation With npm: npm install react-pirate With yarn: yarn add react-pirate Usage Uti

Octave Raimbault 53 Aug 31, 2022
Super Simple React Hooks for react-redux.

RRH What's this? Simple React Hooks of React Redux Dependencies You must install some dependent packages before use RHH. react redux Install npm npm i

Taketoshi Aono 13 Aug 26, 2019
A small package of custom React hooks that are useful for debugging changes in React hook dependencies across renders

use-debugger-hooks This is a package of custom React hooks that are useful for debugging dependency changes between renders. Most act as drop in repla

Kyle Shevlin 48 Nov 9, 2022
React hooks for generating QR code for your next React apps.

React hooks for generating QR code for your next React apps.

Bunlong VAN 77 Dec 30, 2022