From the course: The Freelance Stack: Real Project with Next.js and Strapi

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Create button from InfoBlock Strapi data on page

Create button from InfoBlock Strapi data on page - Next.js Tutorial

From the course: The Freelance Stack: Real Project with Next.js and Strapi

Create button from InfoBlock Strapi data on page

Now, we're already very close to finishing a huge part off here, because we now are able to display our data on the front end that comes through Strapi. But what's missing is the button here and here, so we're going to take care of that now. The way we are going to take care of that is also in the cleanest way I could think of doing that, which also means there's a little bit more work involved now, but it's just going to make it so much nicer to work with after. So if we go into our info block here, we just log out the data.button, we're going to see the kind of data that actually comes through from our, from Strapi. Now it's not very complex data, but what we need to create from that data is a button that will change depending on all of these values. So for me, the way that it makes the most sense here is to actually create your own helper function to create that kind of HTML element. So what we're going to do here is we're going to export, actually we don't have to export it I…

Contents