storybook/docs/snippets/react/mock-context-in-use.js.mdx
2021-06-28 23:00:33 +01:00

21 lines
454 B
Plaintext

```js
// ProfilePage.js | ProfilePage.jsx
import { useContext } from 'react';
import ProfilePageContext from './ProfilePageContext';
const ProfilePage = ({ name, userId }) => {
const { UserPostsContainer, UserFriendsContainer } = useContext(ProfilePageContext);
return (
<div>
<h1>{name}</h1>
<UserPostsContainer userId={userId} />
<UserFriendsContainer userId={userId} />
</div>
);
};
export default ProfilePage;
```