main
Line | |
---|
1 | function OpinionTree({ professor }) {
|
---|
2 | function displayChildPosts(post) {
|
---|
3 | if (post == null) return;
|
---|
4 | return (
|
---|
5 | <div key={post.postId}>
|
---|
6 | <p>Содржина: {post.content}</p>
|
---|
7 | {post.children.map((child) => displayChildPosts(child))}
|
---|
8 | </div>
|
---|
9 | );
|
---|
10 | }
|
---|
11 |
|
---|
12 | return (
|
---|
13 | <div className="opinionTree">
|
---|
14 | {professor.relatedOpinions.map((opinion) => {
|
---|
15 | if (opinion.hasOwnProperty("title")) {
|
---|
16 | return (
|
---|
17 | <div key={opinion.postId}>
|
---|
18 | <p>Наслов: {opinion.title}</p>
|
---|
19 | <p>Содржина: {opinion.content}</p>
|
---|
20 | {opinion.children.map((child) => displayChildPosts(child))}
|
---|
21 | </div>
|
---|
22 | );
|
---|
23 | }
|
---|
24 | })}
|
---|
25 | </div>
|
---|
26 | );
|
---|
27 | }
|
---|
28 |
|
---|
29 | export default OpinionTree;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.