Skip to content

Commit

Permalink
Replace <Context.Provider> with <Context>
Browse files Browse the repository at this point in the history
<Context.Provider> isn't deprecated yet, but the React 19 release post
says it will be.
  • Loading branch information
ahamlinman committed Jan 5, 2025
1 parent c78699c commit a86726c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/src/TunerStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type Status =
| { Connection: "Disconnected" | "Connecting" }
| ({ Connection: "Connected" } & TunerStatus);

const Context = React.createContext<null | Status>(null);
const Context = React.createContext<Status | null>(null);

export const useTunerStatus = (): Status => {
const status = React.useContext(Context);
Expand Down Expand Up @@ -64,5 +64,5 @@ export const TunerStatusProvider = ({
return close;
}, []);

return <Context.Provider value={status}>{children}</Context.Provider>;
return <Context value={status}>{children}</Context>;
};
4 changes: 2 additions & 2 deletions client/src/WebRTC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface State {
MediaStream: undefined | MediaStream;
}

const Context = React.createContext<null | State>(null);
const Context = React.createContext<State | null>(null);

export const useWebRTC = (): State => {
const state = React.useContext(Context);
Expand Down Expand Up @@ -39,7 +39,7 @@ export const WebRTCProvider = ({ children }: { children: React.ReactNode }) => {
};
}, []);

return <Context.Provider value={state}>{children}</Context.Provider>;
return <Context value={state}>{children}</Context>;
};

const defaultState = (): State => ({
Expand Down

0 comments on commit a86726c

Please sign in to comment.