showing results for - "how to get code suggestions for react components"
Finn
26 Mar 2020
1    import React, { Component } from 'react';
2    import PropTypes from 'prop-types';
3    import UiStore from './store';
4
5    /**
6     * @typedef Props
7     * @prop {UiStore} uiStore
8     */
9
10    /**
11     * @extends {Component<Props, {}>}}
12     */
13    export default class DeviceMirror extends Component {
14        static propTypes = {
15            // not needed for intellisense but prop validation does not hurt
16            uiStore: PropTypes.instanceOf(UiStore),
17        }
18        /**
19         * @param {Props} props - needed only when you don't write this.props....
20         */
21        constructor(props) {
22            super(props);
23            this.s = props.uiStore.str;
24        }
25        render() {
26            const { uiStore } = this.props;
27            return <p>{uiStore.str}</p>;
28        }
29    }