I'm trying to add Laravel existing conditional statement on ReactJs component
I've tried to add it on render function.
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
export class Login extends Component {
render() {
return (
<div class="login">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
/*-- <a href="{{ route('register') }}">Register</a>
@if (Route::has('register'))
@endif */
@endauth
</div>
@endif
</div>
);
}
}
if (document.getElementById('login')) {
ReactDOM.render(<Login />, document.getElementById('login'));
}
<div id="login"> </div>
require('./components/Welcome');
I'm trying to display the existing laravel script from react components.
Thanks in advance for the help.