Basic Syntax

These two are equivalent

Using const syntax for javascript

const logHelloWorld = () => {
    console.log("Hello World");
}

Using function syntax for javascript

function logHelloWorld() {
    console.log("Hello World");
}

These two are equivalent

Using const syntax for JSX

const App = () => {
    return (
        <View>
            <Text>This is an app</Text>
        </View>
    );
}

Using function syntax for JSX

These two are equivalent

Closing tag for components that do not encapsulate anything

Self-closing tag for components that do not encapsulate anything

These three are equivalent

Nesting components together

Extracting the components into their own components within the same page

Extracting the components into their own components into other files, export them and importing them for use

Last updated