Skip to content

Instantly share code, notes, and snippets.

@martshaw
Last active October 4, 2018 19:16
Show Gist options
  • Save martshaw/d8a8d483eb80fc153618e578c8b98807 to your computer and use it in GitHub Desktop.
Save martshaw/d8a8d483eb80fc153618e578c8b98807 to your computer and use it in GitHub Desktop.
Answers

Question 1(Level 1) (15 mins)

What are your thoughts about the advantages and disadvantages of using CSS in JS approach? Expected result: Written explanation of your thoughts.

Answer

Is it right or not depends on a number of factors, mainly are the development team aligned on this and is the infrastructure of the project/environment suitable to be able to use it.

Advantages

  • Leverage the JS ecosystem to enhance CSS
  • Share constants between JS and CSS
  • Dead code elimination
  • Thinking in components, css-in-js abstracts to the component level rather than from the document.

Disadvantages

  • Lack of portability need to be in JS driven environment
  • Readability - semantically classes can become optimised
  • Linters / syntax completion tools are limited
  • More learnings and more libraries (styled-components, styletron, styled-jsx, Emotion, etc)

Alternatively if css-in-js is not for you then maybe css modules. Write your css in a css file and import it into your module.

Look at the requirements and break down what solutions fits best and do not jump on a band wagon without properly assessing the advantages and disadvantages. Finally what ever you / team are happy working with and meets the requirements of your task will be the best solution for all.

Question 2(Level 2) (45 mins)

Given the applicationData structure below please extract the values while keeping the structure.

The expected output is in a variable below es6 is encouraged and allowed, only latest Chrome is required to run the solution. https://jsfiddle.net/8vhwhvjt/

Expected result: code should be provided

Answer

Question 4(Level 3) (2 hour)

Write babel plugin that transpiles all the console.log(n) calls to console.log(“Bonify rocks” + n); and publish it as a npm package with travis or any other deployment tool. Expected result: npm package with babel plugin

Answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment