📚 API ReferenceComponents
<Perception>
The <Perception /> Component allows the Agent to perceive and react to real-world events.
The <Perception />
component is used to define and register a perception within the Agent's context. It allows the agent to handle specific types of perceptions with custom logic.
Import
Usage
Here's an example of how to use the <Perception />
component:
Props
Prop | Type | Default |
---|---|---|
type | string | N/A |
handler | Function | N/A |
children | ReactNode | N/A |
Methods
The <Perception>
component does not expose any public methods. All interaction should be handled through props or by wrapping the component with additional logic.
Best Practices
- Event Handling: Ensure that your event handling logic is efficient and does not block the main thread. Consider using asynchronous functions or web workers for complex processing.
- Configuration: Use the
config
prop to fine-tune the perception logic to suit your specific use case. This can help optimize performance and accuracy.
Troubleshooting
- No Response: If the component does not seem to be responding to events, check that your event handlers are correctly implemented and that the component is properly mounted in the DOM.
- Performance Issues: If you experience performance issues, review your event handling logic and consider optimizing or offloading intensive tasks.