Skip to content

Commit 8ab57d8

Browse files
remove unwanted code
1 parent f992e96 commit 8ab57d8

File tree

2 files changed

+0
-102
lines changed

2 files changed

+0
-102
lines changed

beta/src/components/MDX/Sandpack/Console.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ export const SandpackConsole: React.FC<{clientId?: string}> = ({clientId}) => {
117117
return <span key={`${msg}-${index}`}>{msg}</span>;
118118
}
119119

120-
console.log('console', console);
121-
122120
const children = JSON.stringify(msg);
123121

124122
return (

beta/src/pages/apis/usecontext.md

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,6 @@
11
---
22
title: useContext
33
---
4-
<Sandpack>
5-
6-
7-
```js
8-
console.log('strek')
9-
10-
import { createContext, useContext, useState } from 'react';
11-
12-
const ThemeContext = createContext(null);
13-
14-
export default function MyApp() {
15-
const [theme, setTheme] = useState('light');
16-
return (
17-
<ThemeContext.Provider value={theme}>
18-
<Form />
19-
<label>
20-
<input
21-
type="checkbox"
22-
checked={theme === 'dark'}
23-
onChange={(e) => {
24-
setTheme(e.target.checked ? 'dark' : 'light')
25-
}}
26-
/>
27-
Use dark mode
28-
</label>
29-
</ThemeContext.Provider>
30-
)
31-
}
32-
33-
function Form({ children }) {
34-
return (
35-
<Panel title="Welcome">
36-
<Button>Sign up</Button>
37-
<Button>Log in</Button>
38-
</Panel>
39-
);
40-
}
41-
42-
function Panel({ title, children }) {
43-
const theme = useContext(ThemeContext);
44-
const className = 'panel-' + theme;
45-
return (
46-
<section className={className}>
47-
<h1>{title}</h1>
48-
{children}
49-
</section>
50-
)
51-
}
52-
53-
function Button({ children }) {
54-
const theme = useContext(ThemeContext);
55-
const className = 'button-' + theme;
56-
return (
57-
<button className={className}>
58-
{children}
59-
</button>
60-
);
61-
}
62-
```
63-
64-
```css
65-
.panel-light,
66-
.panel-dark {
67-
border: 1px solid black;
68-
border-radius: 4px;
69-
padding: 20px;
70-
margin-bottom: 10px;
71-
}
72-
.panel-light {
73-
color: #222;
74-
background: #fff;
75-
}
76-
77-
.panel-dark {
78-
color: #fff;
79-
background: rgb(23, 32, 42);
80-
}
81-
82-
.button-light,
83-
.button-dark {
84-
border: 1px solid #777;
85-
padding: 5px;
86-
margin-right: 10px;
87-
margin-top: 10px;
88-
}
89-
90-
.button-dark {
91-
background: #222;
92-
color: #fff;
93-
}
94-
95-
.button-light {
96-
background: #fff;
97-
color: #222;
98-
}
99-
```
100-
101-
</Sandpack>
1024
<Intro>
1035

1046
`useContext` is a React Hook that lets you read and subscribe to [context](/learn/passing-data-deeply-with-context) from your component.
@@ -280,9 +182,7 @@ In this example, the `MyApp` component holds a state variable which is then pass
280182
281183
<Sandpack>
282184
283-
284185
```js
285-
console.log('strek')
286186

287187
import { createContext, useContext, useState } from 'react';
288188

0 commit comments

Comments
 (0)