Basic Syntax
Last updated
function App() {
return (
<View>
<Text>This is an app</Text>
</View>
);
}function App() {
return (
<Button title="Press Me"></Button>
);
}function App() {
return (
<Button title="Press Me" />
);
}const MainComponent = () => {
return (
<View>
<View>
<Text>Subcomponent one</Text>
</View>
<View>
<Text>Subcomponent two</Text>
</View>
</View>
);
}const MainComponent = () => {
return (
<View>
<SubComponentOne />
<SubComponentTwo />
</View>
);
}
const SubComponentOne = () => {
return (
<View>
<Text>Subcomponent one</Text>
</View>
);
}
const SubComponentTwo = () => {
return (
<View>
<Text>Subcomponent two</Text>
</View>
);
}// index.jsx
import SubComponentOne from "./component-one.jsx"
import SubComponentTwo from "./component-two.jsx"
const MainComponent = () => {
return (
<View>
<SubComponentOne />
<SubComponentTwo />
</View>
);
}
// component-one.jsx
const SubComponentOne = () => {
return (
<View>
<Text>Subcomponent one</Text>
</View>
);
}
export default SubComponentOne;
// component-two.jsx
const SubComponentTwo = () => {
return (
<View>
<Text>Subcomponent two</Text>
</View>
);
}
export default SubComponentTwo;