Getting Started
npm install jspsych-react
You can use the Experiment
component to include a jsPsych experiment in your React project. For example:
;;; { return <div> <Experiment settings= timeline: visualOddball plugins= "callback-html-display": callbackHTMLDisplay "callback-image-display": callbackImageDisplay /> </div> ; }
You can also import the jsPsych object to access other jsPsych functionality, such as updating the progress bar during a jsPsych experiment. For example:
; const updateProgress = jsPsych;
API
Props
Experiment
Name | Type | Default | Description |
---|---|---|---|
settings | object |
required |
The settings object is passed to the jsPsych.init() function and defines many aspects of an experiment. It can contain many parameters, but the only required parameter is a timeline. See the the jsPsych API documentation. |
plugins | object |
null |
Custom plugins to be passed to jsPsych for use in the experiment. Object keys should match the names of the plugins referenced in the timeline. |
License
MIT © Teon Brooks