Summary
In this chapter, you learned how to handle static assets and meta tags in Remix.
First, we introduced you to the meta
route module export. You learned that Remix injects the meta
function’s return value into the head of the HTML element by using the Meta
component. Remix will always use the closest meta
function export and ignore all other meta
function exports higher up in the route hierarchy.
You also learned that Remix runs meta
functions both on the client and server. Remix passes the meta
function, a data
property that can be used to access the route’s loader data. After following this chapter, you should understand that the data
property of the meta
function can potentially be undefined if a loader
function throws an error. Hence, it is important to only conditionally access loader data in meta
functions.
You also practiced typing the matches
parameter and learned how to access other matching route data in the meta
function.
Next, you learned...