INSERT INTO people (last_name, first_name, sex, birthday)
VALUES ('Иванов', 'Иван', 'm', TO_DATE('1999-04-04', 'YYYY-MM-DD'));
function App(props) {
const [ items, setItems ] = React.useState([...props.items]);
const [ name, setName ] = React.useState('');
const add = () => setItems([
...items,
{
id: 1 + Math.max(0, ...items.map(n => n.id)),
name,
},
]);
return (
<div>
<div>
<input onChange={e => setName(e.target.value)} />
<button onClick={add}>add</button>
</div>
{items.map(n => (
<div key={n.id}>
{Object.entries(n).map(([ k, v ]) => <div>{k}: {v}</div>)}
</div>
))}
</div>
);
}
Heroku не хочет моё приложение, как быть?
.listen(process.env.PORT || 5000)
const express = require('express')
const path = require('path')
const PORT = process.env.PORT || 5000
express()
.use(express.static(path.join(__dirname, 'public')))
.set('views', path.join(__dirname, 'views'))
.set('view engine', 'ejs')
.get('/', (req, res) => res.render('pages/index'))
.listen(PORT, () => console.log(`Listening on ${ PORT }`))
get searchtest() {
const search = this.state.search.toLowerCase().trim();
return search
? searchtest.filter(n => Object.values(n).some(m => m.toLowerCase().includes(search)))
: searchtest;
}
{this.searchtest.map((kef, i, a) => ( <div style={style}> <div key={kef.name} data-id={kef.name}> name: {kef.name} </div> <div key={kef.id} data-id={kef.id}> id: {kef.id} </div> </div> ))}
{this.searchtest.map(n => (
<div key={n.id}>
<div>name: {n.name}</div>
<div>id: {n.id}</div>
</div>
))}
const [ active, setActive ] = useState(null);
const item = test.title[active];
const onClick = e => setActive(e.target.dataset.id);
{Object.keys(test.title).map(n =>
<button key={n} data-id={n} onClick={onClick}>{n}</button>
)}
{item && <div>{item.title} ---- {item.category}</div>}