メインコンテンツに進む

このページ

useResetRecoilState(状態)

指定された状態の値をデフォルト値にリセットする関数を返します。


function useResetRecoilState<T>(state: RecoilState<T>): () => void;
  • コピー

状態: 書込み可能なRecoil状態

import {todoListState} from "../atoms/todoListState";

const TodoResetButton = () => {
const resetList = useResetRecoilState(todoListState);
return <button onClick={resetList}>Reset</button>;
};