fresh
fresh copied to clipboard
docs: create docs for _app.tsx
I've decided to write some docs on my own (regarding issue #491) . Keep in mind that I have no technical writing experience and treat it more like a sketch. All suggestions are welcome - most importantly, check if everything I wrote is true.
Additionally, I slipped in 1 typo fix
You might want the app-wrapper.md
file to focus on layout (and maybe renamed to layout.md
) and have _app.tsx
as one option. Another option would be to use a Layout component to wrap the app. Both of them could use the Head component to add an html head element with its child elements to the app.
You might want the app-wrapper.md file to focus on layout (and maybe renamed to layout.md) and have _app.tsx as one option. Another option would be to use a Layout component to wrap the app. Both of them could use the Head component to add an html head element with its child elements to the app.
I'm not sure if splitting this feature into 2 pages is such a good idea. If it's possible, please propose your changes by code suggestions. But all of this doesn't really matter, because it seems this PR is not getting merged. I hope the replacement for _app.tsx
will get implemented soon, as this feature seems to really needed by users.
Thank you I almost given up
Any update on this getting merged? I think it's pretty clear.
Not sure if this makes sense to merge given that _app.tsx
will be removed in favor of layouts (at some distant point in the future). I'd still support it being merged since this is kind of the only way to do it at the moment.
@lino-levan I think it would be good to add this until the layout feature comes along. I guess the layout feature is still a ways off.
Agreed.
@lambtron Code example updated to the latest. I have also verified that the description is correct, could you double check?
The following are memo during confirming what has been written:
There is also a possibility to modify the document template by using special tags
html
,Head
orbody
. This can be done in any other Preact component
I tried this. Indeed, I was able to do this from components as written.
Currently, there is no way of overriding default tags/attributes from provided template.
This is also true. For example, setting <body class="foo">
in _app.tsx
and <body class="bar" data-baz="1">
in index.tsx
will render <body class="foo" data-baz="1">
. You can add attribute but not overwrite.
(There is a <html lang="en">
set before _app.tsx'
, so _app.tsx
also cannot override by lang="ja"
)
LGTM!