Skip to content

Commit e6bc742

Browse files
committed
provider -> context
1 parent 142d12b commit e6bc742

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

website/directionContext.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { createContext, useContext } from 'react';
22

33
import type { Direction } from '../src/types';
44

5-
const DirectionContext = createContext<Direction>('ltr');
6-
7-
export const DirectionContextProvider = DirectionContext.Provider;
5+
export const DirectionContext = createContext<Direction>('ltr');
86

97
export function useDirection(): Direction {
108
return useContext(DirectionContext);

website/routes/__root.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createRootRoute, Outlet } from '@tanstack/react-router';
33
import { css } from '@linaria/core';
44

55
import type { Direction } from '../../src/types';
6-
import { DirectionContextProvider } from '../directionContext';
6+
import { DirectionContext } from '../directionContext';
77
import Nav from '../Nav';
88

99
export const Route = createRootRoute({
@@ -23,11 +23,11 @@ function Root() {
2323
const [direction, setDirection] = useState<Direction>('ltr');
2424

2525
return (
26-
<DirectionContextProvider value={direction}>
26+
<DirectionContext value={direction}>
2727
<Nav direction={direction} onDirectionChange={setDirection} />
2828
<main dir={direction} className={mainClassname}>
2929
<Outlet />
3030
</main>
31-
</DirectionContextProvider>
31+
</DirectionContext>
3232
);
3333
}

0 commit comments

Comments
 (0)