S
S
sinevik2018-01-29 17:56:43
React
sinevik, 2018-01-29 17:56:43

Why doesn't it find pictures when Router is running?

Please tell me, I compile the react webpack files, the output is one index.js file.
I connect to html, and all the pictures on the site work fine

avatar:"../img/bmw.jpeg",
              mark: "bmw",
              model: "X1",
              body: "sedan",
              value: 3000,
              description: "asdasdasdasdasdasdasdasdasdasdasdasdasd",

But if I use the Router library, I start the dev server and go to
localhost:6060/main
class location extends React.Component {
  constructor(props){
    super(props);
    }


  render() {	
      	return (
      		<Router>
            <div>
        			<Route path="/main" exect component={Main}></Route>
        			<Route path="/pagetwo/:id" component={PageTwo}></Route>
            </div>
         </Router>

        	)
   	
  

  }

}
export default location;

It doesn’t find the picture, don’t tell me how to write the address correctly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2018-01-31
@cimonlebedev

Try to run the node via express-static if the node exists of course

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question