reactjs - Webpack load pdf and csv within react component -
hi i've created project based on react starter kit i'm trying resolve pdf that's saved local file system within react component
return( <div classname={s.root}> <div classname={s.container}> <h1>results: {this.props.caseid}</h1> <h2>data</h2> </div> <h2>graph</h2> <div> <a href={require(this.state.graphpdf)} download={this.state.graph}>{this.state.graph}</a> </div> </div> </div> )
where this.state.graphpdf
= /users/[username]/desktop/outputs/graphs/graph.pdf
but receive following error:
error: cannot find module "." - results.js:67 webpackmissingmodule /users/radhika/oncostem-digital- project/src/routes/results/results.js:67:1 - results.js:67 results.render /users/radhika/oncostem-digital- project/src/routes/results/results.js:67:1
i think issue i'm missing loader in webpack.config file (i'm using same 1 that's in starter project). i'm not familiar webpack loaders or webpack in general, i'm not sure configuration should be.
Comments
Post a Comment