I'm using react js in laravel, I created one useful element with JSX extension record and tried to use an easy variable but was not able to apply that during the HTML tag.
import React from 'react';
//functional component
const HeaderComp = () => {
const MIX_APP_URL = process.env.MIX_APP_URL;
console.log(MIX_APP_URL);//here working fine
return (
<header>
{/*Here not working*/}
<img src="{MIX_APP_URL}" className="img img-fluid" />
</header>
);
}
1 Replies
I can see that you do not exported your component ,
you need to write export default HeaderComp ; in the bottom of the component
and there is one more mistake -- Try without the quotes: src={MIX_APP_URL}