Passage
He who keeps his commandments remains in him, and he in him. By this we know that he remains in us, by the Spirit which he gave us.
He who keeps his commandments remains in him, and he in him. By this we know that he remains in us, by the Spirit which he gave us.
1 John 3:22 and whatever we ask, we receive from him, because we keep his commandments and do the things that are pleasing in his sight.
1 John 3:23 This is his commandment, that we should believe in the name of his Son, Jesus Christ, and love one another, even as he commanded.
1 John 3:24 He who keeps his commandments remains in him, and he in him. By this we know that he remains in us, by the Spirit which he gave us.
The verse centers on "Spirit", "keeps", "commandments", "remains", and "gave". It is saying that the verse draws attention to "Spirit" and "keeps", so its meaning should be read from those terms before moving to application.
The prior verse says "This is his commandment that we should...", giving immediate footing for "Spirit" and "keeps". In 1 John context, the local focus is Christ, faith, and discipleship.
A plain takeaway is to answer the verse's own emphasis on "Spirit" and "keeps" with trust shaped by these words, not by a vague optimism outside the passage.