Sign in
Log inSign up

Extending a stateless React component?

Americo's photo
Americo
·Jan 30, 2019

Hello everyone,

I am very new to React and I need to create a app that uses a stateless component to show a dropdown. The code for the dropdown is in this Microsoft link: developer.microsoft.com/en-us/fabric#/comp… My question is how can I make this component stateless? Is it possible? I saw other samples where people show how to write stateless component and in my test they works fine but they are no so complex like the one in the MS page. In my test I just render a simple text. The difference between my test code and the one in the MS page is that in the MS the component is extending a BaseComponent and I don't know how to do that in the stateless test I have.

Right now my test code is like this:

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import styles from './Footer.module.scss';

const footer = () => {
    return (
        <div className={styles.footer}>
                <div className={styles.main}>
                    <div className="ms-Grid">
                        <div className="ms-Grid-row">
                            <div className="ms-Grid-col ms-sm6 ms-md8 ms-lg10">
                                <p>other text</p>
                            </div>
                            <div className="ms-Grid-col ms-sm6 ms-md4 ms-lg2">
                                <p>DropDown</p>
                            </div>
                        </div>
                    </div>

                </div>

            </div>
    )
};

export default footer;

Best reagards Americo