Render component as string but pass value in

Hi,

Is there a way of using this function but passing a string in to be
used?

render_component_as_string()

if not is there another way of capturing the output from one action into
a string?

Thanks