question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

With transclusion, is there any way to use in a second document variables exported in the parent document?

See original GitHub issue

My use case is to have independent mdx files with the same export const but different content, and then that each file imports (transcludes) a second mdx file that acts as a sort of template, but that should use those constants exported in the former (parent) doc

my_mdx_file.mdx

export const title = 'my title'

This is a provided component **Hello** by **MDXProvider**

<Hello />

This template is provided by **MDXProvider**

<Template />

template.mdx

This is the title

<div>{title}</div>

And this is the same component also accessible here

<Hello />

*I can just add a .js template, but I loss the mdx format and agility, and that this template should also have access to the same components provided by MDXProvider (in the js file I should import them)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kuworkingcommented, Apr 29, 2020

Completely right 👍

my_mdx_file.mdx

export const title = 'hey'
<Template title ={title} />

template.mdx

<div>{props.title] Here it works</div>

export const Title = (props) => <div>{props.title] Here it also works</div>

<Title title={props.title} />
1reaction
wooormcommented, Apr 28, 2020

yup!

Read more comments on GitHub >

github_iconTop Results From Across the Web

MultiMarkdown User's Guide - GitHub Pages
A program to convert plain text to a fully formatted document. The syntax used in the plain text to describe how to convert...
Read more >
Trying to export a bash variable from an .sh file to another file ...
Source the script (using the . ) to call it in the same shell. You then don't even need to export the value....
Read more >
Passing pieces of markup to components in Angular 2 and ...
In this article we'll research how to pass custom markup to Angular components and how to create different types of dynamic components.
Read more >
Exporting Variables - SCons
There are two ways to export a variable, such as a construction environment, from an SConscript file, so that it may be used...
Read more >
Dependency injection in action - Angular
Angular throws an error if the parent lacks that service, even if a component higher in the component tree includes it. A second...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found