forked from oliverjam/minimal-react-setup
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from facn5/init
Init
- Loading branch information
Showing
13 changed files
with
64 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,9 @@ | |
"extends": [ | ||
"eslint:recommended", | ||
"react-minimal" | ||
] | ||
} | ||
], | ||
|
||
"rules": { | ||
no-console : 0, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
</head> | ||
|
||
<body> | ||
<div id="🤡"></div> | ||
<div id="ter"></div> | ||
<script src="index.js"></script> | ||
</body> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,51 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Input from './components/input'; | ||
import Button from './components/button/button.js' | ||
import PortfolioCard from './components/card'; | ||
import Image from './components/image' | ||
import "./style.css"; | ||
import { getData, API_BASE } from "./tools/getData"; | ||
class App extends React.Component { | ||
state = { | ||
userOne:"", | ||
userTwo:"", | ||
userOneData:'', | ||
userTwoData:'', | ||
|
||
} | ||
// componentDidUpdate(){ | ||
// alert(this.state.userOne + this.state.userTwo); | ||
// } | ||
onclickHandler = () => { | ||
const username1 = this.state.userOne; | ||
const username2 = this.state.userTwo; | ||
// const url = `${API_BASE}/users/tamernasser`; | ||
const url1 = `${API_BASE}/users/${username1}`; | ||
const url2 = `${API_BASE}/users/${username2}`; | ||
|
||
getData(url1).then(d =>{ | ||
console.log(d); | ||
this.setState( {userOneData:d} ); | ||
}); | ||
getData(url2).then(d =>{ | ||
console.log(d); | ||
this.setState( {userTwoData:d} ); | ||
}); | ||
|
||
} | ||
render(){ | ||
return(<div> | ||
<div className="inputs-container"> | ||
<Input updateUser={(value) => this.setState({ userOne: value})}/> <Button /> <Input updateUser={(value) => this.setState({ userOne: value})} /> | ||
<Input updateUser={(value) => this.setState({ userOne: value})}/> | ||
<button onClick={this.onclickHandler} /> | ||
<Input updateUser={(value) => this.setState({ userTwo: value})} /> | ||
</div> | ||
<div className="cards-container"> | ||
<PortfolioCard userdata={this.state.userOneData} /> | ||
<img /> | ||
<PortfolioCard userdata={this.state.userTwoData}/> | ||
</div> | ||
</div> | ||
<div className="cards-container"> | ||
<PortfolioCard /> <Image /> <PortfolioCard /> | ||
</div> | ||
</div> | ||
)}} | ||
|
||
|
||
ReactDOM.render(<App/>, document.getElementById('🤡')); | ||
ReactDOM.render(<App/>, document.getElementById('ter')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters