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-…
The Most Overlooked Aspect Of UX Design Could Be The Most Important – blog.marvelapp.com/empty-sta… Email Updates
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
Installerade precis Synergy. I'm in heaven.. typ. (synergy-project.org)
Det här gör ont i själen: "In the case of a large CSS file, you will need to identify and inline the CSS..." developers.google.com/speed/…
Debatten handlar om människosyn #aftonbladet aftonbladet.se/debatt/articl…
The Future of Unreal Tournament Begins Today unrealengine.com/blog/the-fu…
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
Jo men klart du ska provspela, varsågod och sitt... blocket.se/vi/52869308.htm
Fantastiskt bra! Gillar också meningen "...for clients who do not understand latin." blokkfont.com/








