Reputation: 1839
I have the following code in a basic react app
import React from 'react';
import './App.css';
function genColor() {
return <div style="#000000">Test</div>;
}
function App() {
return (
<div className="App">
{this.genColor()}
</div>
);
}
export default App;
Calling genColor
in the App function, but get
How am I screwing this up?
Upvotes: 0
Views: 174
Reputation: 24086
You've created a global function, but you're calling it as if it's a member of App.
So either move the function to the App class, or remove this.
Upvotes: 2