File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,27 @@ Heres a component rendered inline:
111111
112112```
113113
114+ ## Controlling JavaScript
115+
116+ You can pass simple props to components. However, if you need to write more advanced JavaScript, its recommended to declare it in the imports section.
117+
118+ ``` markdown
119+ ---
120+ imports: |
121+ import { SomeComponent } from './SomeComponent';
122+
123+ const dynamic = () => import('./SomeComponent');
124+
125+ console.log('You can put anything here!');
126+ ---
127+
128+ <SomeComponent simple="string" />
129+ <SomeComponent advanced={dynamic} />
130+
131+ ```
132+
133+ Anything added to the ` imports ` front matter is added between the React import and component declaration in the outputted module.
134+
114135## Syntax Highlighting
115136
116137Syntax highlighting is done using PrismJS and is picked up automatically by tagging code blocks:
You can’t perform that action at this time.
0 commit comments