Created
September 23, 2021 15:46
-
-
Save AnishDe12020/18669d0e6147706c8dad2ac7641029f2 to your computer and use it in GitHub Desktop.
Medium - Getting Started with React Ink
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
#!/usr/bin/env node | |
'use strict'; | |
const React = require('react'); | |
const importJsx = require('import-jsx'); | |
const {render} = require('ink'); | |
const meow = require('meow'); | |
const ui = importJsx('./ui'); | |
const cli = meow(` | |
Usage | |
$ sandbox | |
Options | |
- name Your name | |
Examples | |
$ sandbox - name=Jane | |
Hello, Jane | |
`); | |
render(React.createElement(ui, cli.flags)); |
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
'use strict'; | |
const React = require('react'); | |
const {Text} = require('ink'); | |
const App = ({name = 'Stranger'}) => ( | |
<Text> | |
Hello, <Text color="green">{name}</Text> | |
</Text> | |
); | |
module.exports = App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment