- Feb 2022
-
dmitripavlutin.com dmitripavlutin.com
-
Clean form code. Pretty elegant + covers best practices. This video also showed me some previously unknown HTML features.
Tags
Annotators
URL
-
- Nov 2021
-
dmitripavlutin.com dmitripavlutin.com
-
{ target: { value } }
This might seem confusing at first glance. However this is just simple "nested destructruing" and "smart function parameters" used together
Read the "Nested Destructuring" and "Smart Function Parameters" sections from the link below to get a better idea of what's going on.
https://javascript.info/destructuring-assignment#object-destructuring
the set() function can also be written as -----
let set = (name) => { return ( (e) => { setDetails( {...details , [ name ] : e.target.value }); console.log(details); }) }
notice how the predeclared variable
name
is being used as a key in the object.{ [name] : value }
NOT{ name : value}
. Skipping the box brackets will throw you an error This is becausename
is actually a variable. Similar to the way in which we useobject[key] = value;
notation to add a k-v pair, we have to use{ [name] : value }
ie. enclose the variable name in square brackets while creating an object using object literal syntax to make sure that the code works
Tags
Annotators
URL
-
- Oct 2020
-
github.com github.com
-
github.com github.com
-
In general it is recommended you handle forms in this "controlled" manner. In some cases it might make sense to manage the form state outside of Solid via refs. These "uncontrolled" forms can also work. Just be conscious of the difference as mixing approaches can lead to unexpected results.
-
- Jul 2020
-
github.com github.com
Tags
Annotators
URL
-
- Jun 2020
-
www.reddit.com www.reddit.com
-
Man, just because it gets rid of SO MUCH boilerplate I want to switch already.It kills me everytime I work with forms in React. So much noise for such a simple task.
-
- Oct 2019
-
github.com github.com
- Aug 2019
-
codesandbox.io codesandbox.io
-
github.com github.com
Tags
Annotators
URL
-