"+7(555)777-44-44".replace(/\D/g, '')
"+ 7 78(555)777-44-44".replace(/\+.+\(|\D/g, '')
// Find all anchors and images with the "title" attribute
$ret = $html->find('a[title], img[title]');
// data = массив такого вида
Array(12).fill().map((item, index) => {
const month = data.find(m => m.month === index + 1)
return month ? month.sum : ''
})
// data = массив такого вида
result = Array(12).fill('')
for(let i = 0; i < data.length; i++) {
result[data[i].month - 1] = data[i].sum
}
.findOne({
private: true,
users: {
$all: [ctx.state.userId, ctx.request.body.interlocutorId]
}
})
You need to remove the mode: 'no-cors' setting from your request. That mode: 'no-cors' is exactly the cause of the problem you’re having.
A mode: 'no-cors' request makes the response type opaque. The console-log snippet in the question clearly shows that. And opaque means your frontend JavaScript code can’t see the response body or headers.
fetch('http://....')
.then(res => res.json())
.then(res => {
this.setState({loaded: true, items: res.items})
})
.catch(err => {
console.log('OH SHIT:', err)
this.setState({loadError: true})
})
function App() {
const [current, setCurrent] = React.useState(null)
return (
<div className="App">
<Point disabled={current !== 'Point'} onClick={() => setCurrent('Point')} />
<Line disabled={current !== 'Line'} onClick={() => setCurrent('Line')} />
</div>
);
}
class Line extends Base { // какой еще Base?
render() {
return (
<button disabled={this.props.disabled} onClick={this.props.onClick}>
Линия
</button>
);
}
}
// App
state = { mass: [] }
onFileRead = mass => {
this.setState({ mass: mass })
}
render () {
// console.log(this.state.mass)
return <TextFileReader txt={myTxt} onFileRead={this.onFileRead}/>
}
// TextFileReader
readFile = mass => {
this.props.onFileRead(mass)
// когда будет готов массив, то пусть он прокинется наверх в App
}