I am trying to draw gridlines inside a square. Here is my code:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[scale=1.25,line width=1pt]
\begin{axis}[
color= white,
xmin=-28.9,
xmax=28.9,
ymin=-28.9,
ymax=28.9,
axis equal image,
axis lines=middle,
]
\foreach \x in {-24,..., 24}
{\draw[thin, gray] (\x,-24) -- (\x,24);}
\draw[black, thin] (-24,-24) -- (-24,24) -- (24,24) -- (24, -24) --
(-24,-24);
\node[black, below] at (24,-24) {$(1,0)$};
\node[black, below] at (-24,-24) {$(0,0)$};
\node[black, above] at (-24,24) {$(0,1)$};
\node[black, above] at (24,24) {$(1,1)$};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
This code, however, will not compile. My goal is to make a square with a 24 x 24 grid.

