DEV Community

Tips for Ionic Developers React / Vue

Try to avoid mixing Tabs and Menu for Routing

It introduces extra complexity and reduces flexibility.
If you really think about it do you really need to mix them both?


Changing Mode

By default, when an app is viewed in the browser, Ionic will apply the md mode. However, since Ionic components adapt according to their platform, it is helpful to be able to view what the app will look like on iOS. To do this, add ?ionic:mode=ios to the URL where the app is being served. For example, if the app is served on port 8100, the url would be: http://localhost:8100/?ionic:mode=ios.


Using a Debugger​

The debugger keyword can be used to debug an app. When most browsers encounters a debugger statement, running of JavaScript is stopped, and the browser will load its debugger. This can be used to set "breakpoints" in the app.

For example, if a function is not returning the correct value, the debugger can be used to step through the code and inspect variables.

 function myBrokenFunction() {
  debugger;
  // do other stuff
}
Enter fullscreen mode Exit fullscreen mode

When an app runs, it will pause at this function. From there, the developer tools can be used to run pieces of JavaScript, line by line, and inspect where exactly the function breaks.


πŸ’‘ One of the most fundamental principles of software architecture

Code that change together should stay together.

Discussion (0)