I am still a rookie in frontend. I have 2 NON RELATED (no parent/child relation) classes:
search.js
Class Search{
method,
state
}
view.js
Class view{
content
}
I am trying to:
- call a search.js method from view.js.
- change state value of search.js from view.js
Additional info:
- I have already tried using helper functions. It was not the desired solution.
- I am using Preact which is a leightweight version of React.
Thanks!
Code:
export default class Search extends Component {
constructor() {
this.state = {
input: ""
};
}
search(input) {
this.setState({ input: input });
}
}