You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -161,8 +161,8 @@ displaying different kinds of posts. First, define your two components:
161
161
Then, you can choose which to render based on the data:
162
162
163
163
```gjs {data-filename=app/templates/index.gjs}
164
-
import RootPost from '../components/root-post.gjs';
165
-
import ReplyPost from '../components/reply-post.gjs';
164
+
import RootPost from 'my-app/components/root-post';
165
+
import ReplyPost from 'my-app/components/reply-post';
166
166
167
167
// returns either RootPost or ReplyPost (default: RootPost)
168
168
function getPostComponent(postType) {
@@ -182,8 +182,8 @@ function getPostComponent(postType) {
182
182
This is great when `RootPost` and `ReplyPost` take the same arguments, like `author` and `body` in the above example. But what if the components accept different arguments? One way would be to move the selection conditional into the template, like so:
183
183
184
184
```gjs {data-filename=app/templates/index.gjs}
185
-
import RootPost from '../components/root-post.gjs';
186
-
import ReplyPost from '../components/reply-post.gjs';
185
+
import RootPost from 'my-app/components/root-post';
186
+
import ReplyPost from 'my-app/components/reply-post';
187
187
188
188
const eq = (a, b) => a === b;
189
189
@@ -217,9 +217,9 @@ The first parameter of the helper is a component to render. So `{{component Blog
217
217
The `component` helper is often used when yielding components to blocks. For example the layout for a SuperForm component might be implemented as:
0 commit comments