SDK Version: 49.0.9
Platform: web
Expo Router Version: 2.0.5
Hi, I’m building a mobile application that should also be a website, and we would like the SEO to be good. I’m trying Static Rendering, but the resulting HTML does not contain the rendering of the component, just a few
tags without content.
Below is an example of a component and the HTML of the rendered path.
app/[user].tsx
import {useLocalSearchParams} from "expo-router";
import {Text} from "react-native";
export default () => {
const { user } = useLocalSearchParams();
return <>
<Text>User: {user}</Text>
</>
};
export async function generateStaticParams(): Promise<Record<string, string>[]> {
return [
{ user: 'peter' },
{ user: 'john' },
];
}
dist/peter.html
<html>
(...)
<body>
<div id="root">
<div class="css-175oi2r" style="flex:1">
<div class="css-175oi2r r-13awgt0"></div>
</div>
</div>
<script src="/_expo/static/js/web/entry-00afcc889f9913bcacd64134a46793e4.js" defer></script>
</body>
</html>
Is this the expected behaviour. Is there a way to statically generate a first render of the component with the user’s name in the HTML?
Thank you.