Why is it so complicated to write?
import React, { Component } from 'react'
import './styles.css'
class App extends Component {
constructor() {
super()
this.state = {
list: ['A', 'B', 'C', 'D'],
current: 0,
content: [
['img a-1', 'img a-2', 'img a-3'],
['img b-1', 'img b-2', 'img b-3'],
['img c-1', 'img c-2', 'img c-3'],
['img d-1', 'img d-2', 'img d-3']
]
}
}
handleClick = index => this.setState({ current: index })
render() {
return (
<div className="tab-panel">
<ul className="tabs">
{this.state.list.map((v, i) => (
<li
key={v}
className={i === this.state.current ? 'active' : ''}
onClick={() => this.handleClick(i)}
>
{v}
</li>
))}
</ul>
<ul className="content-container">
{this.state.content.map(
(v, i) =>
v.length && (
<li key={i} className={i === this.state.current ? 'show' : 'hidden'}>
{v.map((img, index) => <img key={index} src={img} alt={img} />)}
</li>
)
)}
</ul>
</div>
)
}
}
export default App
Previous: Tomcat failed to deploy application, access 404
Next: When crawlers, the web page is displayed in normal Chinese, but the source code is messed up.
...
componentWillReceiveProps =(newProps)=> { const _self = this; console.log( ); console.log( newProps = , newProps[ basicInformationData ]); let videoLength = 0; let videoSize = 0; let distanc...
I want to use Fetch to grab the data and return the captured data, but now I call the postFromServer function. I can t wait for Fetch, to return a undefined, directly. How can I solve this problem? module.exports = { postFromServer ( requestParam ...
recently added Wechat login function, the project is created through create-react-app, similar to 1 in the following figure, how should js be referenced? Can the sections of 2 and js be written directly into Component? ...
related codes index1.js export function getInitTime() { const nowTime = new Date(); const nowTimeStamp = new Date().getTime(); return { nowTime, nowTimeStamp } } index2.js import { getInitTime } from . index1 ; console.log(ge...
related codes index1.js export function getInitTime() { const nowTime = new Date(); const nowTimeStamp = new Date().getTime(); return { nowTime, nowTimeStamp } } index2.js import { getInitTime } from . index1 ; console.log(ge...
related codes index1.js export function getInitTime() { const nowTime = new Date(); const nowTimeStamp = new Date().getTime(); return { nowTime, nowTimeStamp } } index2.js import { getInitTime } from . index1 ; console.log(ge...
problem description case: there is a Form form in which the data is an obj object. When the attribute a satisfies the condition 1, it needs to be deleted. Is there any way not to affect whether the obj object still contains a attributes. let ob...