storybook/docs/snippets/react/mock-context-in-use.js.mdx
2021-09-03 23:31:04 +01:00

19 lines
432 B
Plaintext

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