Tag Archives: link
Cool talk on js event loop and call stack
It’s junior-middle level, but animations are great. https://youtu.be/8aGhZQkoFbQ Here’s an article about almost the same but in more details about difference between tasks’ queue (timeouts) and microtasks’ queue (promises and DOM modifications). The main idea is that there are several queues that have different priorities. And microtasks are more important than tasks. https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/
React. Benchmarking and optimizing performance
There is a tool called react-addons-perf that should be imported into your project.
1 2 3 |
import Perf from 'react-addons-perf'; window.Perf = Perf; |
After that you can use Perf object in your console. It can tell you about your react performance issues, not including redux. For instance, you can check unnecessary renders or unnecessary change calculations:
1 2 3 4 5 6 |
Perf.start(); // do whatever you want to measure Perf.stop(); Perf.printOperations(); // to show DOM manipulations Perf.printWaisted(); // to show unneeded calculations for components which remained the same afterwards |
Here’s more on that — https://reactjs.org/docs/perf.html. And …
MVC vs Flux
They are all architecture patterns. M is for model. It stores generic logic for the model like fields and calculations based on the fields like validation and stuff. V is for view. It just renders stuff and passes user interactions (events) to its controller via the controller’s API. C is for controller that ties models …
Nice scheduling service
And can be used for free. Calendar where you can post a schedule when you’re available for something to share with others. https://calendly.com/
Publish subdirectory of a project to gh-pages
If your build is located at ./build, then do this:
1 |
git subtree push --prefix build origin gh-pages |
More details here — https://gist.github.com/cobyism/4730490
Testing react’s dom with jest and enzyme
Install it like this:
1 |
yarn add enzyme enzyme-adapter-react-16 --registry="https://registry.npmjs.org" |
Regression testing of react app with jest
Example is here — https://facebook.github.io/jest/docs/en/tutorial-react.html. The main idea is this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Link.react.test.js import React from 'react'; import Link from '../Link.react'; import renderer from 'react-test-renderer'; test('Link changes the class when hovered', () => { const component = renderer.create( <Link page="http://www.facebook.com">Facebook</Link>, ); let tree = component.toJSON(); expect(tree).toMatchSnapshot(); // manually trigger the callback tree.props.onMouseEnter(); // re-rendering tree = component.toJSON(); expect(tree).toMatchSnapshot(); // manually trigger the callback tree.props.onMouseLeave(); // re-rendering tree = component.toJSON(); expect(tree).toMatchSnapshot(); }); |
UTF-8 icons
https://tutorialzine.com/2014/12/you-dont-need-icons-here-are-100-unicode-symbols-that-you-can-use Icon-like Smiley ☺ ☺ ☺ Hot Springs ♨ ♨ ♨ 8-Ball ➑ ➑ ➑ White Star ☆ ☆ ☆ Black Star ★ ★ ★ White Heart ♡ ♡ ♡ Black Heart ❤ ❤ ❤ Airplane ✈ ✈ ✈ Black Scissors ✂ ✂ ✂ White Scissors ✄ ✄ ✄ Crown ♕ ♕ ♕ Cross ✝ …
How to handle js errors in your react app
https://hackernoon.com/a-user-encounters-a-javascript-error-youll-never-guess-what-happens-next-dc1a6f725490 In russian — https://habrahabr.ru/company/ruvds/blog/344682/
Yet another article about js-interview
https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e In russian — https://habrahabr.ru/post/345882/