0
0
ETEstee Tey
if you need a way to update a custom context through a hook, this recipe will generate an example of how to write such a hook.
import { createContext } from "react";
export interface Tweet {
id: string;
content: string;
}
export interface TweetContext {
tweets: Tweet[],
setCurrTweets: (tweets: Tweet[]) => void;
}
const defaultContext: TweetContext = {
tweets: [],
setCurrTweets: () => { },
};
const TweeterContext = createContext<TweetContext>(defaultContext);
export default TweeterContext;