0

can i implements react.js in codeigniter i have try but if i load file.js there is a 403, i'm new in react.js can someone help me

this is my structure file if i load header.js i see error 403 access denied:

enter image description here

this my header.php file

<div class = "tes">
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script>
<script src="<?php echo base_url('application/views/template/header.js');?>"></script>

and this my header.js file

'use strict';

function formatName(user) {
  return user.firstName + ' ' + user.lastName;
}

var user = {
  firstName: 'Harper',
  lastName: 'Perez'
};

var element = React.createElement(
  'div',
  { 'class': 'navbar-container ace-save-state', id: 'navbar-container' },
  React.createElement(
    'button',
    { type: 'button', 'class': 'navbar-toggle menu-toggler pull-left', id: 'menu-toggler', 'data-target': '#sidebar' },
    React.createElement(
      'span',
      { 'class': 'sr-only' },
      'Toggle sidebar'
    ),
    React.createElement('span', { 'class': 'icon-bar' }),
    React.createElement('span', { 'class': 'icon-bar' }),
    React.createElement('span', { 'class': 'icon-bar' })
  ),
  React.createElement(
    'div',
    { 'class': 'navbar-header pull-left' },
    React.createElement(
      'a',
      { href: '<?php echo site_url(\'dashboard\');?>', 'class': 'navbar-brand' },
      React.createElement(
        'small',
        null,
        React.createElement('i', { 'class': 'fa fa-briefcase' })
      )
    )
  ),
  React.createElement(
    'div',
    { 'class': 'navbar-buttons navbar-header pull-right', role: 'navigation' },
    React.createElement(
      'ul',
      { 'class': 'nav ace-nav' },
      React.createElement(
        'li',
        { 'class': 'light-blue dropdown-modal' },
        React.createElement(
          'a',
          { 'data-toggle': 'dropdown', href: '#', 'class': 'dropdown-toggle' },
          React.createElement('img', { 'class': 'nav-user-photo', src: '' }),
          React.createElement(
            'span',
            { 'class': 'user-info' },
            React.createElement(
              'small',
              null,
              'Welcome,'
            )
          ),
          React.createElement('i', { 'class': 'ace-icon fa fa-caret-down' })
        ),
        React.createElement(
          'ul',
          { 'class': 'user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close' },
          React.createElement(
            'li',
            null,
            React.createElement(
              'a',
              { href: '#' },
              React.createElement('i', { 'class': 'ace-icon fa fa-cog' }),
              'Settings'
            )
          ),
          React.createElement(
            'li',
            null,
            React.createElement(
              'a',
              { href: 'profile.html' },
              React.createElement('i', { 'class': 'ace-icon fa fa-user' }),
              'Profile'
            )
          ),
          React.createElement('li', { 'class': 'divider' }),
          React.createElement(
            'li',
            null,
            React.createElement(
              'a',
              { href: '<?php echo site_url(\'login/logout\');?>' },
              React.createElement('i', { 'class': 'ace-icon fa fa-power-off' }),
              'Logout'
            )
          )
        )
      )
    )
  )
);

ReactDOM.render(element, document.getElementById('tes'));

and sorry for my bad english

2
  • I think you are just forgetting the import statement at ,the top: import 'React' from 'react'; I think that should fix the problem Commented Jan 25, 2018 at 22:15
  • you forgot babel.js Commented Feb 7, 2018 at 21:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.