Building a responsive table with higher-order components
Functional components are very good wrappers when we have to decide which component to actually wrap. In this recipe, you'll write a responsive table that will display different columns depending on the browser width.
Getting ready
This recipe is about functional components. If you want to warm up, you can try and complete the previous recipe.
How to do it...
For this recipe, we will use the excellent semantic UI CSS framework. To use it, you have to include the CSS library as a dependency or as a <link>
tag. For example, you can put the following code in the <head>
of your HTML:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.7/semantic.css" />
If you are using JSFiddle, the link inside should be sufficient.
Another tag you have to add to your page for it to look good on mobile is this:
<meta name="viewport" content="width=device-width">
This tells the mobile browser that the width...