Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Site Bugs / Suggestions
  4. Not being rendered properly

Not being rendered properly

Scheduled Pinned Locked Moved Site Bugs / Suggestions
javascriptcsscomhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohibur Rashid
    wrote on last edited by
    #1

    this text is not being rendered properly in Quick Answers section

    Hi all,
    i'm doing my first steps in react.
    this code should write "On" but i get "App.js: Unexpected token, expected ( "
    what am i missing?

    import React, { Component } from 'react';
    import logo from './logo.svg';
    import './App.css';

    class Light extends React.Component {

    constructor(props) {
    	super(props);
    	this.state = {light:"On"};
    };
    	
    function formatLightState() {
    	return <h1>{this.state.light}</h1> ;
    }
    
    render() {
    	return (
    	<div>
    		{this.formatLightState()}
    	</div>
    	);
    }
    

    }

    class App extends React.Component {
    constructor(props) {
    super(props);
    }

    renderLight(){
    return <Light />
    }

    render() {
    return (
    <div>
    {this.renderLight()}
    </div>
    );
    }

    }

    export default App;

    this is the link that was giving me hard time Problem creating the simplest react progrem[^]

    I do not fear of failure. I fear of giving up out of frustration.

    C 1 Reply Last reply
    0
    • M Mohibur Rashid

      this text is not being rendered properly in Quick Answers section

      Hi all,
      i'm doing my first steps in react.
      this code should write "On" but i get "App.js: Unexpected token, expected ( "
      what am i missing?

      import React, { Component } from 'react';
      import logo from './logo.svg';
      import './App.css';

      class Light extends React.Component {

      constructor(props) {
      	super(props);
      	this.state = {light:"On"};
      };
      	
      function formatLightState() {
      	return <h1>{this.state.light}</h1> ;
      }
      
      render() {
      	return (
      	<div>
      		{this.formatLightState()}
      	</div>
      	);
      }
      

      }

      class App extends React.Component {
      constructor(props) {
      super(props);
      }

      renderLight(){
      return <Light />
      }

      render() {
      return (
      <div>
      {this.renderLight()}
      </div>
      );
      }

      }

      export default App;

      this is the link that was giving me hard time Problem creating the simplest react progrem[^]

      I do not fear of failure. I fear of giving up out of frustration.

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      Fixed.

      cheers Chris Maunder

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups