Skip to content

Commit

Permalink
content(react): fix react context#247
Browse files Browse the repository at this point in the history
  • Loading branch information
lainbo committed Aug 19, 2024
1 parent 22b124d commit 29379c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions content/4-组件组合/5-上下文/react/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState, createContext } from "react";
import { useState } from "react";
import UserProfile from "./UserProfile";

export const UserContext = createContext();
import { UserContext } from "./UserContext";

export default function App() {
// 在实际项目,你会从接口获取用户数据
Expand Down
3 changes: 3 additions & 0 deletions content/4-组件组合/5-上下文/react/UserContext.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createContext } from "react";

export const UserContext = createContext();

0 comments on commit 29379c6

Please sign in to comment.