As we were riding out these different action interfaces, we started making some really big assumptions
about the different properties that a cell would have.
So clearly we are now assuming that a cell inside replication is going to have an ID property.
We're kind of also assuming that a cell might have a type property that describes if it's for code or
text.
And we're also really assuming that a cell is going to have a content property as well.
So at this point in time, I think that we might want to create another interface inside of maybe another
file inside of our state directory.
And maybe this interface should describe exactly what a cell is.
So what is a cell?
What properties does it have?
We can create one interface to describe this and then start to share those different properties or make
use of that interface around all these different parts of our redux application.
So inside of my state's directory, I'm going to make a new file called Cell, and inside of here I'm
going to define and export in interface.
That I will call simply sell.
So on this interface will describe all the different properties we expect to sell to have.
Well, I think that a sale should probably have an ID so we can uniquely identify each one.
I think that it should probably have maybe a type that will be either code or text.
And again, this is going to say, is this a code cell or is it a markdown documentation cell?
And then finally, we can have maybe content or data doesn't really make a big difference.
I think content probably makes a lot of sense.
You're so content will be the code in a code cell or the text for a text cell.
And I think in total, these are probably all the properties we really need to describe an individual
cell.
Now that we've got this interface put together, we might want to try to better define or have a better
way of referencing the type, for example, or content or all these different things.
Back inside of our action file, for example, we now have kind of a duplicate definition around what
possible types of cells there are inside of insert cell.
Before action.
We had put the typewrite here and we had said clearly that we are kind of assuming that there are two
kinds of cells available to us, a code cell in a text cell.
So we're defining that in one place and then defining that over inside of our cell interface as well.
So what would happen if in one location we have text and in the other location we have markdown?
Well, now all of a sudden these two interfaces are not really compatible in any in any way.
Because for one, it's saying that we can have a cell of type text, but our canonical or like the official
concrete definition of what a cell is, is saying, hey, we can actually have code and markdown, not
text.
So, again, we might want to create just one single location that says here are the different possible
types of cells we can have.
So for that, we might might want to create another type up top and export it.
We call it maybe cell types.
And have this be.
Something like code meat, we export type, there we go, OWD or text, and now we could refer to that
right here.
We could import this into our actions definition file.
So at the very top, I can import.
Cell types from up on directory cell.
And then refer to that right here as well.
So now, if we ever decide to define additional cell types and cyber application, for example, right
now code is really kind of implicitly always JavaScript.
Maybe we decide to also support other kinds of code cells as well.
So maybe Java or Python or something.
Well, then we can very easily redefine this and say, oh, yeah, we can have a JavaScript type cell
and a Java type cell, a text cell, maybe an HTML cell and so on.
And we can make all these updates and just this one single location.
So I think that this is definitely a good improvement.
OK, so this looks pretty good.
We now have a single location that says here's exactly what a cell is now.
We've put this together, as I mentioned, another quick pause and we'll come back and start taking
care of our reducers and our different action creators as well.