D
D
Denoro552018-10-13 23:00:18
HTML
Denoro55, 2018-10-13 23:00:18

Why is the background style substituted with a curved path with a variable in React?

Hello everyone
Such a problem that I substitute the path in the background and it is some kind of curve substituted

{
                  this.props.messages.map(function(element,i){
                    console.log(element.image) // \images\upload\den\Animals__038809_.jpg
                  return (
                    <li key={i} className="chat-message">
                      <div className="chat-avatar" style={{background: `url(${element.image})`}}> // background: url("imagesuploadÞn\a nimals__038809_.jpg");
                      </div>
                      <div className="chat-message-content">
                        <div className="chat-message-name">
                          {element.name}
                        </div>
                        <div className="chat-message-text">
                          {element.text}
                        </div>
                      </div>
                    </li>
                  )
                })}

That is, in my variable, the path is: \images\upload\den\Animals__038809_.jpg
and as a result, when rendering, it becomes: background: url("imagesuploadÞn\a nimals__038809_.jpg");
With image substitution, there is no such thing in Img

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question