@paul-grist I think your code is ok. But React has some great tools to handle intializing states that makes code a little nicer.
Please allow me to share how I would do it in React:
function App() {
const [data, setData] = React.useState({});
React.useEffect(() => {
grist.onRecord((record) => setData(record));
grist.ready();
}, []);
return (
<p>Hello {data.Name}</p>
);
}
ReactDOM.render(<App />, document.getElementById("root"));