Amazing work so far, and I think we have acquired enough knowledge to create a simple Amazon best selling
book list.
Now, what am I talking about?
If we navigate to search engine mistype Amazon best selling books now, don't worry, Mom, I'm going
to ask you to buy anything, but we will try to recreate at least some parts of it using Riak.
Now, you can pick any book you would like, but I'm going to go with this one because this one is by
far the most favorite book of my daughter.
And I have probably read this and I want to say a thousand times, but I don't think that's even close
to a real number.
So here what I was looking for.
We're going to go back to our application and we'll just give it a more meaningful name.
Keep in mind, you can call this greeting, but I'm going to go with a booklist, let's say, book lists,
and eventually there will be a list of books.
Then we're going to go with book list as well, and then I'll do a little bit of spring cleaning where
for the time being, I'll say that it is going to be our section.
And here, let's write this is a book list.
Now, of course, there's nothing there right now.
And where we have the person and message, well, eventually it's going to be two different components.
So I'll just remove them.
And once we separate, of course, we have this.
This is a book list.
So now, of course, I would want to create four components.
Now, please keep in mind, technically, I could just set up one where I have the book and in the book
I could have the image, I could have the title as well as the author.
Now, I'll purposefully put this up into three components, meaning there's going to be a book component
and then in there there's going to be three separate components, one for him and one for title and
one for author, just to showcase how we would narced those components even more.
And then later we will refactor it back to one book.
And this is just to showcase that it is up to you how you want to structure your application.
If you want to create everything has a component, you can definitely do it, or you can just place
everything in one book component.
So where we have the book list right after that, I'm going to create another component.
Now, in this case, though, I'm going to use our function again.
You can use regular function if you want, but I'm going to go with a function.
We have our parameters.
We have implicit return.
And then as far as return, I would want to return the article.
So another moment and in there are going to be three separate components for time being.
I'll just say this is a book, OK, we save that.
And then where we have the book list now or we could do is just get rid of this generic text and say
that I'm looking for the book.
So once I save it, I have this book.
Now it's really, really, really, really cool.
Poldrack is that I can add multiple instances of that book.
So if I start just copying and pasting the same instance of the book, notice how here I'm getting these
values as well.
So what that means is that the moment I'll change something in my book, that of course it will affect
all the instances that I have.
So here I'll say this is a book and outrageous around you.
This is a car.
And of course, it's not going to make sense.
But you'll see right away that all my instances in here are, which is really, really, really cool.
And of course, I'm going to have five thousand of them.
I can one of them can have three of them or whatever.
And then later we'll take a look at how we can render with a different name for it, because we need
to understand that, of course, at the moment it will just hard code this one value.
But it's already really cool that we could multiply it on a fly and then change it in one place, because
notice, it's not like I had to hop from one place to another one to change this text.
I just set up the component I copied how many times I wanted.
And then once I change something in here, that's it.
All the instances will be affected.
Now I will go back to my one single book.
And like I said, it's going to be a little bit of overkill right now, but I'll set up three separate
components.
So in here I'll call this image and I'll just try an implicit return because one.
So we'll return image and in order to get that image.
Just click on it and you're looking for the copy image address.
That's the one you need and then place it here in stores.
Now, as far as the alternative.
I'm not going to worry about it.
And that where we have the book instead of this is a car, which totally doesn't make sense.
Now, I'm just looking for this image.
So like I said, even though this is a component, I can invest even more components.
So I have a book that is rendered in a book.
However, in the book, there's going to be three separate components that's separate and there is not.
Of course, I have my image now.
What's next?
Well, now what I would want is to grab a title as well as the author.
And again, it's going to be a little bit of overkill, but will create two more components.
So let's call this author.
And of course, we would need to set up our turn again, you want implicit, you can set up implicit.
If you want explicit, you can set up explicit.
I think I'm going to go with implicit where I'm going to go with having one.
And by the way, I have this federal function.
And as far as the value, let's just or not didn't copy.
So let me grab this one, by the way.
I think I was going for the author.
My apologies.
I think I'm going to have to remind us it's not going to be author is going to be a title, My Bad.
So that's my title.
And then right after this image, I would want to add my title so that, of course, my title Kampot
it is now I have my caporn.
And lastly, of course, let's also the author.
So we're going to go consed and then author again, implicit, explicit, whatever.
You can set up a traditional function if you want, and then we're looking for this value.
So let me figure out how I can copy that Mark show and I don't know how I'm going to play this in having
four copy and paste.
And then of course I'll do the same thing over here where we are going to go with an author.
So now once we set this up, now I have my book component in that book component, I have three separate
components, one for the image, one for the title and one for the author.
And then where I render my book, if I increase it notes.
So now, of course, we'll have these multiple instances and we already saw the moment I'll change something
around here.
It will affect all the instances where I render my book and my opinion.
It's a really, really awesome because as you can see, we can nicely utilize our component structure
where we can have as many instances as we would want, but we control them in only one place.
And the moment we add those changes, all the instances will be affected.