Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

reactjs - "[ts] Unterminated regular expression literal."

I'm getting this error in an almost empty react component:

"[ts] Unterminated regular expression literal."

import * as React from 'react';

export default class EmptyComponent extends React.Component {

    render() {

        return (
            <p>Hello</p>
        );
    }
}

I don't know what I'm doing wrong!

question from:https://stackoverflow.com/questions/47601987/ts-unterminated-regular-expression-literal

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It turns out I was using the .ts file extension instead of .tsx

Make sure your component file extension is .tsx (if you're using Typescript) or .jsx (if you're using Javascript).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...