Created
April 3, 2021 11:57
-
-
Save Mullets-Gavin/b8a4b77fdd01e9cd21c6f111ea252bd3 to your computer and use it in GitHub Desktop.
Roblox Typescript React Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Class Component": { | |
"prefix": "component", | |
"body": [ | |
"import Roact from \"@rbxts/roact\";", | |
"", | |
"interface ${1:App}State {}", | |
"interface ${1:App}Props {}", | |
"", | |
"export class ${1:App} extends Roact.Component<${1:App}Props, ${1:App}State> {", | |
"\tconstructor(props: ${1:App}Props) {", | |
"\t\tsuper(props);", | |
"\t}", | |
"", | |
"\trender() {", | |
"\t\treturn <frame />;", | |
"\t}", | |
"}", | |
"" | |
], | |
"description": "Create a handy class component" | |
}, | |
"Story Template": { | |
"prefix": "story", | |
"body": [ | |
"import Roact from \"@rbxts/roact\";", | |
"import { ${1:Component} } from \"../${2:Path}\";", | |
"", | |
"export = (target: Frame): (() => void) => {", | |
"\tconst app = <${1:Component} />;", | |
"\tconst mount = Roact.mount(app, target);", | |
"", | |
"\treturn () => {", | |
"\t\tRoact.unmount(mount);", | |
"\t};", | |
"};", | |
"", | |
], | |
"description": "Create a default story template" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment