Tzook Bar Noy
Tzook Bar Noy

Reputation: 11677

React Redux create container with render function for template

I want to create a container with simple html template like this:

<div>
    <one />
    <two />
    <three />
</div>

thats all... so how do I use a container with creating it with

connect(mapStateToProps,mapDispatchToProps)(ViewComponent);

as in this way, I have no option for regular render...

any ideas?

thanks

Upvotes: 1

Views: 257

Answers (2)

VanDavv
VanDavv

Reputation: 836

I would use Stateless function instead of component:

import React from 'react';

const Foo = () => (
<div>
  <one />
  <two />
  <three />
</div>
);

Foo.propTypes = {};

const mapStateToProps = () => {}

const mapDispatchToProps = {}

export default connect(mapStateToProps,mapDispatchToProps)(Foo);

Upvotes: 0

Codesingh
Codesingh

Reputation: 3384

You can code like this:

import {one} from ""
import {two} from ""
import {three} from ""
import {component} from react
import {connect} from react-redux

export default class ViewComponent extends component
{
  constructor(props)
  {
    super(props)
  }
  render()
  {
   return(
      <one />
      <two />
      <three />
   );
  } 

}

connect(mapStateToProps,mapDispatchToProps)(ViewComponent);

Upvotes: 1

Related Questions