Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

How to import a markdown file in a typescript react-native project?

$
0
0

I have tried to import a markdown file into my typescript react-native project in 2 ways.

import * as readme from "./sample.md"
import readme from "./sample.md"

Both didn't work. So I found a similar issue reported previously and mentioned about making a typings.d.ts file for declaring modules, and i've tried this as well but it still doesn't work.

declare module "*!txt" {    const value: any;    export default value;}declare module "*.md" {    const value: any;    export default value;}

EDIT:There is no import error on Vscode but on the react-native app itself, it says that it cannot find module './sample.md' as it is only looking for (.native|.ios|.json|.ts etc) files.

Any help would be appreciated, been stuck on this for far too long.Thank you!


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>