Closed seokju-na closed 2 weeks ago
resolves #79
Currently, custom components were not supported inside <Printer> child nodes, so a renderer function had to be used rather than a component.
<Printer>
This PR improves support for custom components (both function component and class component).
ASIS:
import { render, Printer, Text } from 'react-thermal-printer'; function renderCustomText(text: string) { return <Text>Text: {text}</Text>; } const data = await render( <Printer type="epson"> {renderCustomText('Hello World')} </Printer> );
TOBE:
import { render, Printer, Text } from 'react-thermal-printer'; function CustomText(props: { children: string }) { return <Text>Text: {props.children}</Text>; } const data = await render( <Printer type="epson"> <CustomText>Hello World</CustomText> </Printer> );
Minor changes:
sum
resetPrinter
render
resolves #79
Currently, custom components were not supported inside
<Printer>
child nodes, so a renderer function had to be used rather than a component.This PR improves support for custom components (both function component and class component).
ASIS:
TOBE:
Minor changes:
sum
function with es-toolkitresetPrinter
options torender
function.