-
-
Save samuelloza/784fdf257da0cf1ae933c3dc46a2d3b7 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