Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to load a file #2104

Closed
cesarvarela opened this issue Sep 13, 2017 · 1 comment
Closed

How to load a file #2104

cesarvarela opened this issue Sep 13, 2017 · 1 comment

Comments

@cesarvarela
Copy link

Hi, I need to load a html file and then insert it with dangerouslySetInnerHTML.

How can I do it, I tried fs.readFileSync('./form.html'); but the console logs:

This dependency was not found:

* fs in ./src/components/Contact/index.js

To install it, you can run: npm install --save fs

I guess this is because this uses webpack and not just node, but I'm missing some basic concepts here it seems.

Thanks in advance

@KyleAMathews
Copy link
Contributor

You import it using the raw loader e.g. import htmlFile from 'raw-loader!./form.html'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants