In the simplest RNN, there is only one non-linear, fully connected layer which, at each step t, takes as input :

The vector positioned at t in the sequence : x_t (in your case, its size is 20)
Its own vector output from the previous step : h_(t-1) (in your case, its size is 40)

to output the new vector h_t (in your case, size 40 also).
This vector is the hidden state at step t.
A LSTM is much more complex (see the docs 8 to see how everything is computed), but the global idea is the same.