Created
August 31, 2020 21:59
-
-
Save refayathaque/c282a06a233342127ca30053d2f7ed14 to your computer and use it in GitHub Desktop.
App.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Fragment } from 'react'; | |
import '../styles.css'; | |
import Input from './Input'; | |
import Posts from './Posts'; | |
import Comments from './Comments'; | |
import UserId from './UserId'; | |
import { PostsContextProvider } from '../Hooks/PostsContext'; | |
import { CommentsContextProvider } from '../Hooks/CommentsContext'; | |
export default () => { | |
return ( | |
<div className="commentsContextProvider"> | |
<CommentsContextProvider> | |
<div className="comments"> | |
<Comments /> | |
</div> | |
{/* ^ won't have access to posts bc <PostsContextProvider> is not its parent */} | |
<div className="postsContextProvider"> | |
<PostsContextProvider> | |
<Input /> | |
<div className="postsSiblings"> | |
<UserId /> | |
</div> | |
<div className="postsSiblings"> | |
<Posts /> | |
</div> | |
<div className="postsSiblings"> | |
<Posts listType='titles' header='(Sibling)' /> | |
</div> | |
</PostsContextProvider> | |
</div> | |
</CommentsContextProvider> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment