ReactJS - Keys
Keys avail React identify which items have transmuted, are integrated, or are abstracted. Keys should be given to the elements inside the array to give the elements a stable identity.
For more topics, click below link:
- React JS Setup, Installation, and First React Project: part 1
- ReactJS - JSX: part 2
- ReactJS - Components: part 3
- ReactJS - State and Props: part 4
- ReactJS - Component API: part 5
- ReactJS - Events : part 6
- Reactjs - Form: part 7
- ReactJS - Bootstrap - Buttons: part 8
- ReactJS - Bootstrap - Table: part 9
- ReactJS - Keys: part 10
CRUD
Example:
import React from 'react';
class App extends React.Component {
constructor() {
super();
this.state = {
data: [
{
language: 'Java....',
id: 1
},
{
language: 'C....',
id: 2
},
{
language: 'C++....',
id: 3
},
{
language: 'GO....',
id: 4
}
]
}
}
render() {
return (
<div class="container">
<div>
{this.state.data.map((dynamicComponent, i) =>
<Content key={i} componentData={dynamicComponent} />)}
</div>
</div>
);
}
}
class Content extends React.Component {
render() {
return (
<div>
<div>{this.props.componentData.language}</div>
<div>{this.props.componentData.id}</div>
</div>
);
}
}
export default App;
For more topics, click below link:- React JS Setup, Installation, and First React Project: part 1
- ReactJS - JSX: part 2
- ReactJS - Components: part 3
- ReactJS - State and Props: part 4
- ReactJS - Component API: part 5
- ReactJS - Events : part 6
- Reactjs - Form: part 7
- ReactJS - Bootstrap - Buttons: part 8
- ReactJS - Bootstrap - Table: part 9
- ReactJS - Keys: part 10
For more topics, click below link:
- React JS Setup, Installation, and First React Project: part 1
- ReactJS - JSX: part 2
- ReactJS - Components: part 3
- ReactJS - State and Props: part 4
- ReactJS - Component API: part 5
- ReactJS - Events : part 6
- Reactjs - Form: part 7
- ReactJS - Bootstrap - Buttons: part 8
- ReactJS - Bootstrap - Table: part 9
- ReactJS - Keys: part 10