-
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.
- Loading branch information
1 parent
f3b589a
commit 94e5c1b
Showing
2 changed files
with
29 additions
and
22 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 |
---|---|---|
@@ -1,25 +1,37 @@ | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
|
||
function App() { | ||
// array destructuring | ||
|
||
//access third element using destructuring | ||
/* const [,,third] = ["jess","sapato","pé"] | ||
console.log(third) // pé */ | ||
|
||
// access first element by position using destructuring | ||
/* const [first] = ["jess","sapato","pé"] | ||
console.log(first) //jess */ | ||
|
||
//access by position | ||
/* const names = ["jess","sapato","pé"] | ||
console.log(names[0]) //jess */ | ||
|
||
// object destructuring | ||
|
||
// using destructuring props | ||
function App({name}) { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>src/App.js</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
<h1>Hello,{name}</h1> | ||
</div> | ||
); | ||
} | ||
|
||
// using props | ||
/* function App(props) { | ||
return ( | ||
<div className="App"> | ||
<h1>Hello,{props.name}</h1> | ||
</div> | ||
); | ||
} */ | ||
|
||
export default App; |
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