<form action="some_url" method="POST">
<input type="text" name="username">
<button>Submit</button>
</form>
const form = document.querySelector('form');
const users = ['John', 'Emily', 'Bruce', 'Alice'];
form.addEventListener('submit', event => {
const input = form.querySelector('input[type="username"]');
const index = users.indexOf(input.value);
if (index === -1) {
event.preventDefault();
} else {
input.value = index;
}
});
const fetchData = () => {
fetch('...')
.then(response => response.json())
.then(({ group }) => {
this.setState({
data: group,
car: Object.keys(group)[0]
}, this.filter);
})
.catch(error => {
console.log('404 Not Found');
});
};
saveData(id, medicineName) {
let note = { id, medicineName }
let noteList = AsyncStorage.getItem('noteList');
let parsedNoteList = noteList ? JSON.parse(noteList) : [];
parsedNoteList.push(note);
AsyncStorage.setItem('noteList', JSON.stringify(parsedNoteList));
}
[
{
type: 'Button',
props: {
label: 'Ok'
}
},
{
type: 'Card',
props: {
label: 'News',
Image: 'request...'
}
},
{
type: 'TextInput',
props: {
placeholder: 'Hello'
}
}
];
render
сделать так:{{page.map(element => <element.type {...element.props} />)}}