The Processes and Elements of an Empirica Experiment
What is a React.js component?
// Importing elements and other components
import React, { Component } from "react";
import GivingResponse from "./GivingResponse";
export default class Questionnaire extends Component {
// The state of the questionnaire
state = {
showHint: false,
};
// Handling if the player clicks to show hint (toggles the hint on and off)
handleShowHint = () => {
this.setState({ showHint: !this.state.showHint });
};
render() {
// Getting the props
const { player } = this.props;
return (
<div>
<p> What is the name of the first person to set foot on the moon?</p>
{/* A button that affects the conditional that
determines whether to show the hint or not */}
<button onClick={this.handleShowHint()}>Show hint</button>
{this.state.showHint && <p className="hintcolour">He was American.</p>}
{/* Importing another component for the player to give their answer.
We pass down the prop of the player */}
<GivingResponse player={player} />
</div>
);
}
}How can I redirect a player if I detect they are using a certain browser or a mobile device?
How can I show a different Exit Step to players depending on whether they have finished the game or if the game was cancelled/had a problem?
Can players navigate back and forth between the Exit Steps?
Can a manually sent a player to an exit step?
Last updated
Was this helpful?