1.0.0 • Published 3 years ago
ink-render-string v1.0.0
ink-render-string
ink-render-string provides a render function which will return a string, which is the rendered content of the ink component you pass to the render function.
Install
yarn add ink-render-stringUsage
import { render } from 'ink-render-string';
import { Text } from 'ink';
const Component = () => <Text>Hello World</Text>;
const { output, cleanup } = render(<Component />);
output.includes('Hello World'); //=> true
cleanup(); // cleans up outstanding render resourcesThe render function also returns a number of other instance properties:
output: the rendered outputcleanup: a function which cleans up outstanding render resourcesunmount: a function which unmounts the componentstdout: the original stdoutstderr: the original stderrexitCode: the original exit codeframes: an array of rendered frames