Skip to content

Commit 12371a3

Browse files
author
ashwani-luhaniwal
committed
React Stateless Concept
1 parent b431129 commit 12371a3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

App2.jsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* In this we will discuss the concepts of ReactJS Components
3+
*/
4+
5+
import React from 'react';
6+
7+
/**
8+
* Stateless example
9+
* App is owner of Header and Content
10+
* Creating Header and Content separately and adding them inside JSX tree in App component
11+
* Only App component needs to be exported
12+
*/
13+
class App2 extends React.Component {
14+
render() {
15+
return (
16+
<div>
17+
<Header />
18+
<Content />
19+
</div>
20+
);
21+
}
22+
}
23+
class Header extends React.Component {
24+
render() {
25+
return (
26+
<div>
27+
<h1>Header</h1>
28+
</div>
29+
);
30+
}
31+
}
32+
class Content extends React.Component {
33+
render() {
34+
return (
35+
<div>
36+
<h2>Content</h2>
37+
<p>The content text!!!</p>
38+
</div>
39+
);
40+
}
41+
}
42+
export default App2;

0 commit comments

Comments
 (0)