Create a React Component use only Props



    Khalid Khan

    React Native companion for Typescript

    Above code creates an export interface called AppProps for use by other code. The filename.extComponent class extends React.Component and takes as its props the AppProps interface. The class contains a render function that returns an HTML view with a Text component.

    Library: react-native

    Shortcut: reactnative.componentwithprops

    import * as React from 'react';
    import { View, StyleSheet, Text } from 'react-native';
    export interface AppProps {
    export default class filename.extComponent extends React.Component<filename.extProps, any> {
      constructor(props: filename.extProps) {
      public render() {
        return (
              <Text>filename.ext Component</Text>
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.