Rikard Kling retweeted
⚛️ Here's a fun React tip: `useReducer` is a better `useState`, and it's easier to adopt than you may think.
Group related values together and spread them in the reducer. Then, updating is just:
updateThing({ prop: newValue })
And there's even more benefits to `useReducer`...
![Screenshot of React code showing two approaches to updating state:
Separate useState hooks:
const [message, setMessage] = useState('');
const [tags, setTags] = useState([]);
const [status, setStatus] = useState('active');
Single useReducer hook:
const [todo, updateTodo] = useReducer(
(data, partialData) => ({
...data,
...partialData,
}),
{ message: '', tags: [], status: 'active' }
);](https://pbs.twimg.com/media/FkWhrzHXkAA5tJS.jpg?name=small&format=webp)
ALT Screenshot of React code showing two approaches to updating state: Separate useState hooks: const [message, setMessage] = useState(''); const [tags, setTags] = useState([]); const [status, setStatus] = useState('active'); Single useReducer hook: const [todo, updateTodo] = useReducer( (data, partialData) => ({ ...data, ...partialData, }), { message: '', tags: [], status: 'active' } );
Rikard Kling retweeted
Accurate: “How it feels to learn Javascript in 2016” by @jjperezaguinaga hackernoon.com/how-it-feels-…
Rikard Kling retweeted
New gameplay footage of Medieval Messenger. It's now possible to backflip kick stuff :D youtube.com/watch?v=WFXP4HoU…
Rikard Kling retweeted
Harrison Ford on his super fan Donald Trump from that fantastic interview with @AngelaBishop! #studio10 snpy.tv/1RFvYgh
Rikard Kling retweeted
I really dig this Morphing Button demo: tympanus.net/Development/But…
Rikard Kling retweeted
271 Years Before Pantone, an Artist Mixed and Described Every Color Imaginable in an 800-Page Book
thisiscolossal.com/2014/05/c… /ht @Dave_Kirkwood
Rikard Kling retweeted
This demo uses a human face to satirize responsive design layout decisions: niravigad.com/responsive_man… #rwd
Rikard Kling retweeted
“14 lousy web design trends that are making a comeback ” econsultancy.com/blog/62335-… (1 year old but still relevant)
Rikard Kling retweeted
OMG. “Frere-Jones is suing Hoefler for half of the world’s preeminent digital type foundry” qz.com/167993/frere-jones-is…
Rikard Kling retweeted
If there is a device testing heaven, I’m pretty sure it looks like @viljamis’ test lab running Remote Preview — youtube.com/watch?v=-n64Cswe…
Rikard Kling retweeted
Coming Soon: Fonts from Monotype Imaging bit.ly/Vz6N0z
Rikard Kling retweeted
Clever li'l symbol font set turning words into icons. symbolset.com/



















