diff --git a/ext.json b/ext.json index b90d7e5c..1cebe2d6 100644 --- a/ext.json +++ b/ext.json @@ -65,6 +65,7 @@ "swift", "systemverilog", "tcl", + "tsx", "twig", "typescript", "vb", diff --git a/names.txt.json b/names.txt.json index 015d8213..9128c603 100644 --- a/names.txt.json +++ b/names.txt.json @@ -66,6 +66,7 @@ "sample.swift.txt", "sample.systemverilog.txt", "sample.tcl.txt", + "sample.tsx.txt", "sample.twig.txt", "sample.typescript.txt", "sample.vb.txt", diff --git a/package.json b/package.json index 9d064094..3691ab3e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Language code example.", "main": "index.js", "scripts": { - "start": "BABEL_ENV=production babel src --out-dir lib --copy-files --verbose" + "start": "BABEL_ENV=production babel src --out-dir lib --copy-files --verbose && npm run create", + "create": "node scripts.mjs" }, "author": "Kenny Wong ", "repository": { diff --git a/txt/sample.tsx.txt b/txt/sample.tsx.txt new file mode 100644 index 00000000..cc07c228 --- /dev/null +++ b/txt/sample.tsx.txt @@ -0,0 +1,30 @@ +import * as React from 'react'; + +interface IState { + clicks: number; +} + +export class Clicker extends React.Component { + constructor(props) { + super(props); + + this.state = { + clicks: 0, + }; + } + + public clickHandler = () => { + this.setState({ clicks: this.state.clicks + 1 }); + } + + public render() { + return ( +
+

You have clicked the button {this.state.clicks} time(s).

+

+ +

+
+ ); + } +} \ No newline at end of file