Starting A Chain Reaction - abukhalil-LTUC-ASAC/amman-401d4 GitHub Wiki

It might not be obvious at first, But.

React does not need a server, backend, really. It can perfectly be used to deploy static files and such and not represent any changes happening to the UI. But that won't be a proper interactive app now, would it?

Ok I got it running, what about unit testing?

Jest is still going to be used, under JSDOM, now personally I would prefer system wide tests known as 'end to end testing' and this is perfectly suited to simulate user input to the expected output, why would you try unit testing over a component? and how small should a unit test be? The possibilities are endless and it makes sense to take the average route and test it that way.

One tool we might be using is npm install --save-dev @testing-library/react the react testing library.

Are events any different in react than plain JS?

Yes & No, they are different as in they are more similar to DOM onClick methods instead of JS add listeners and jQuery methods, much easier and cleaner really. How it works? Simply add the method onClick for an example to any tag and add the function call that invokes the intended reaction. To make class methods work with this.method however, requires method declaration at the constructor first: this.handleClick = this.handleClick.bind(this);

I am done, then what?

You are ready to move the project from development phase where most slow processes happen, and translate it to semi-static phase with lightning fast speeds using npm run build.

But I don't understand how to build my project in react.

read.this to start thinking in react, instead of human.

Vocabularies of the day

  • BDD: unlike TDD, you might have to start thinking of the human in front of the screen, using the app. The best way to know how they might think is to launch early and learn from user behavior through google metrics! Or talk to everyone at work about certain expected behaviors and plan around it.
  • Acceptance Tests: are part of TDD, but its the customer who makes/prioritizes certain tests to develop and pass for.
  • Mounting: and rendering could be confusing, and you are rightly so! Because mounting happens at the first time a component is rendered, attaching it to react's reactivity and the DOM display.