pairwise-tech / pairwise

The Pairwise Codebase
https://app.pairwise.tech
6 stars 0 forks source link

Console logging does not work in React components #253

Closed bonham000 closed 3 years ago

bonham000 commented 3 years ago

For some reason console.log appears to just not work at all when invoked via methods within React components in the workspace. For example in the following code:

import React from "react";
import ReactDOM from "react-dom";

class App extends React.Component<{}, {}> {
  render(): JSX.Element {
    const welcome: string = "Hello, React!";
    console.log("Hello from React!!!");
    return (
      <div>
        <h1>HI</h1>
        <button onClick={this.handleClick}>click...</button>
      </div>
    );
  }

  handleClick = () => {
    console.log("hello...");
    alert("HI");
  }
}

// Do not edit code below this line
const Main = App;
ReactDOM.render(<Main />, document.querySelector("#root"));

The message "Hello from React!!!" is logged but the message in the handleClick handler is not. However, the handleClick method is in fact called (the alert works correctly).

I'm not sure why console.log does not work in this case... It's the same for React Native challenges...

bonham000 commented 3 years ago

This was fixed by #252.