@@ -15,6 +15,7 @@ export const PvalueComponent = ({
1515 const [ isPvalCompareCorrect , setIsPvalCompareCorrect ] = useState ( null ) ;
1616 const [ pvalueComparison , setPvalueComparison ] = useState ( null ) ;
1717 const [ nullHypothesisChoice1 , setNullHypothesisChoice1 ] = useState ( null ) ;
18+ const [ showAnswer , setShowAnswer ] = useState ( false ) ;
1819
1920
2021
@@ -199,15 +200,30 @@ export const PvalueComponent = ({
199200 < div className = "answer-incorrect flex-shrink-0
200201 align-self-start" > !</ div >
201202 < div >
202- The value is incorrect; it’s
203- < span data-cy = "pvalueanswer" > { pvalue } .</ span >
204- { hypothesisTest === 'value_two_sided' && (
205- < span >
206- Note that this is a two-sided test and the
207- table value must be multiplied by two.
208- </ span >
203+ The value is incorrect;
204+ Please try again. { ' ' }
205+ { ! showAnswer ? (
206+ < button
207+ type = "button"
208+ className = "btn btn-link p-0"
209+ onClick = { ( ) => setShowAnswer ( true ) }
210+ data-cy = "pvalueReveal" >
211+ Reveal answer
212+ </ button >
213+ ) : (
214+
215+ < >
216+ It's { ' ' }
217+ < span data-cy = "pvalueanswer" > { pvalue } </ span > .
218+ { hypothesisTest === 'value_two_sided' && (
219+ < span >
220+ Note that this is a two-sided
221+ test and the table value must be
222+ multiplied by two.
223+ </ span >
224+ ) }
225+ </ >
209226 ) }
210- Please try again.
211227 </ div >
212228 </ div >
213229 ) }
0 commit comments